Last active
April 26, 2024 22:50
-
-
Save juliandescottes/dcfa4f4d904780f81b3d1619bf618792 to your computer and use it in GitHub Desktop.
createmessagehandler.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { RootMessageHandlerRegistry } = ChromeUtils.import( | |
"chrome://remote/content/shared/messagehandler/RootMessageHandlerRegistry.jsm" | |
); | |
const { RootMessageHandler } = ChromeUtils.import( | |
"chrome://remote/content/shared/messagehandler/RootMessageHandler.jsm" | |
); | |
const { WindowGlobalMessageHandler } = ChromeUtils.import( | |
"chrome://remote/content/shared/messagehandler/WindowGlobalMessageHandler.jsm" | |
); | |
const mH = RootMessageHandlerRegistry.getOrCreateMessageHandler("test") | |
mH.on( | |
"message-handler-event", | |
(e, a) => console.log(e, a) | |
); | |
mH.handleCommand({ | |
moduleName: "session", | |
commandName: "subscribe", | |
destination: { | |
type: RootMessageHandler.type, | |
}, | |
params: {events: ["log.entryAdded"]} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment