Bug 1203330 Part 2 Convert EventManager uses to SingletonEventManager r=kmag

MozReview-Commit-ID: A12TPwAYzTS
This commit is contained in:
Andrew Swan
2017-01-26 11:27:03 -08:00
parent 1ac8741081
commit d23b45b581
12 changed files with 66 additions and 67 deletions

View File

@@ -8,7 +8,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "EventEmitter",
"resource://devtools/shared/event-emitter.js");
var {
EventManager,
SingletonEventManager,
ignoreEvent,
} = ExtensionUtils;
@@ -131,10 +131,10 @@ extensions.registerSchemaAPI("notifications", "addon_parent", context => {
return Promise.resolve(result);
},
onClosed: new EventManager(context, "notifications.onClosed", fire => {
onClosed: new SingletonEventManager(context, "notifications.onClosed", fire => {
let listener = (event, notificationId) => {
// FIXME: Support the byUser argument.
fire(notificationId, true);
fire.async(notificationId, true);
};
notificationsMap.get(extension).on("closed", listener);
@@ -143,9 +143,9 @@ extensions.registerSchemaAPI("notifications", "addon_parent", context => {
};
}).api(),
onClicked: new EventManager(context, "notifications.onClicked", fire => {
onClicked: new SingletonEventManager(context, "notifications.onClicked", fire => {
let listener = (event, notificationId) => {
fire(notificationId, true);
fire.async(notificationId, true);
};
notificationsMap.get(extension).on("clicked", listener);