| Summary: | command callback parameters and command service cleanup | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Susan McCourt <susan> |
| Component: | Client | Assignee: | Susan McCourt <susan> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | libingw |
| Version: | 0.3 | ||
| Target Milestone: | 0.4 M1 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Susan McCourt
Another thing to cleanup. Right now I save contextual information (enough to invoke a callback) on any command that has a key binding or URL binding. We may want to save this kind of information on all commands so that any command can be executed programmatically by its id vs. a binding. The way parameters are specified is very hacky. Kind of an associative array, but I use two predefined slots (options, optionsTriggered) and treat the remaining slots as parameters. Instead we should have a ParameterDescription object which includes an array of CommandParameters rather than inferring command parameters via the remaining slots. ParameterDescription has options, optionsTriggered, array of CommandParameter CommandParameter should have name, label, value, etc. Fixed. (multiple commits). - There are now real objects for defining parameters (ParametersDescription) and the parameters themselves (CommandParameter) - Got rid of many unnecessary parameters in the renderCommand methods and fixed the order so that callers don't have to include a bunch of "null, null, null" in order to specify more common things like "textOnly" - Defined a CommandInvocation data structure which lets the command service keep one record of a command's context. This is sent as calldata for a callback, so clients can now use data.items data.domNode etc. instead of including a bunch of parameters in the callback that kept changing. This address comment #0 and comment #2. I did not really address comment #1 as I'm not sure I want to store a CommandInvocation for every item-level command. There are some hacks right now in the command framework where we assume that bindings are only used for "global" and "dom" scope. Until we have a real need for invocation/context information for other commands, I'm going to wait on this. |