Closed
Bug 355663
Opened 19 years ago
Closed 19 years ago
Notification system for Composer extensions and sidebars
Categories
(Composer Graveyard :: General, enhancement)
Composer Graveyard
General
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: glazou, Assigned: glazou)
Details
Attachments
(1 file, 2 obsolete files)
4.80 KB,
patch
|
neil
:
review+
|
Details | Diff | Splinter Review |
Composer needs a very simple notification system for extensions and sidebars
allowing a given code to register callbacks for a notification type.
For example, a sidebar item could listen to all selection changes without
having to deal with the too complex command system and writing an overlay for
that. It would only have to include a callback function and call something like
top.NotifierUtils.addNotifier("selectionChanged", myCallback);
The list of default notifications will probably include
selection changed
style applied
before switching to source view
after switching to source view
before switching from source view
after switching from source view
before save/publish
after load
attribute changed
inline CSS styles changed
embedded CSS sheet changed
linked CSS sheet changed
...
Assignee | ||
Comment 1•19 years ago
|
||
Assignee | ||
Comment 2•19 years ago
|
||
minor nit, one "public" function was in the "private" section.
Neil, can you r= ?
Attachment #241434 -
Attachment is obsolete: true
Attachment #241438 -
Flags: review?(neil)
Comment 3•19 years ago
|
||
Comment on attachment 241438 [details] [diff] [review]
fix #2
I don't see a way to remove a callback. (You would want to do that if your sidebar was closed). I also don't understand why you need cleanNotifiers.
Attachment #241438 -
Flags: review?(neil) → review-
Assignee | ||
Comment 4•19 years ago
|
||
Attachment #241438 -
Attachment is obsolete: true
Attachment #241684 -
Flags: review?(neil)
Comment 5•19 years ago
|
||
Comment on attachment 241684 [details] [diff] [review]
fix #3, in answer to Neil's comments
>+ for (var i = 0; i < processes.length; i++)
>+ processes[i](aArg);
You might want to use try/catch here.
Just a thought, you might want to use
a) processes[i](aKeyword, aArg);
to allow the same callback to be used for multiple keywords, or
b) processes[i].apply(null, arguments);
to allow a variable number (or no) arguments to callbacks
[in this case you wouldn't declare an explicit aArg parameter]
Attachment #241684 -
Flags: review?(neil) → review+
Assignee | ||
Comment 6•19 years ago
|
||
(In reply to comment #5)
> You might want to use try/catch here.
>
> Just a thought, you might want to use
> a) processes[i](aKeyword, aArg);
> to allow the same callback to be used for multiple keywords, or
> b) processes[i].apply(null, arguments);
> to allow a variable number (or no) arguments to callbacks
> [in this case you wouldn't declare an explicit aArg parameter]
Yes, excellent suggestions indeed ! Thanks Neil.
Assignee | ||
Comment 7•19 years ago
|
||
fixed and checked in (trunk)
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•