mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 14:45:29 +00:00
Bug 1217129: Part 1 - Add onDestroyed callback to CustomizableUI widgets. r=gijs
--HG-- extra : commitid : vNV77IiNAr extra : rebase_source : fdf99396467cc54cfe3605cddf6db415fb44f077 extra : source : 93266f211716db6c1b5782e6e8d5803baaae1d27
This commit is contained in:
parent
d2848915ff
commit
d0f4aa4a62
@ -2336,6 +2336,7 @@ var CustomizableUIInternal = {
|
||||
this.wrapWidgetEventHandler("onBeforeCreated", widget);
|
||||
this.wrapWidgetEventHandler("onClick", widget);
|
||||
this.wrapWidgetEventHandler("onCreated", widget);
|
||||
this.wrapWidgetEventHandler("onDestroyed", widget);
|
||||
|
||||
if (widget.type == "button") {
|
||||
widget.onCommand = typeof aData.onCommand == "function" ?
|
||||
@ -2439,6 +2440,9 @@ var CustomizableUIInternal = {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (widgetNode && widget.onDestroyed) {
|
||||
widget.onDestroyed(window.document);
|
||||
}
|
||||
}
|
||||
|
||||
gPalette.delete(aWidgetId);
|
||||
@ -3172,6 +3176,11 @@ this.CustomizableUI = {
|
||||
* - onCreated(aNode): Attached to all widgets; a function that will be invoked
|
||||
* whenever the widget has a DOM node constructed, passing the
|
||||
* constructed node as an argument.
|
||||
* - onDestroyed(aDoc): Attached to all non-custom widgets; a function that
|
||||
* will be invoked after the widget has a DOM node destroyed,
|
||||
* passing the document from which it was removed. This is
|
||||
* useful especially for 'view' type widgets that need to
|
||||
* cleanup after views that were constructed on the fly.
|
||||
* - onCommand(aEvt): Only useful for button widgets; a function that will be
|
||||
* invoked when the user activates the button.
|
||||
* - onClick(aEvt): Attached to all widgets; a function that will be invoked
|
||||
|
Loading…
Reference in New Issue
Block a user