зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1217129: Part 1 - Add onDestroyed callback to CustomizableUI widgets. r=gijs
--HG-- extra : commitid : TYTQcrdFSA extra : rebase_source : 5ac4b035020ade4fcff810d64d8faab70017af8f
This commit is contained in:
Родитель
9e41dc86fa
Коммит
2e083ddb04
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче