diff options
Diffstat (limited to 'background/message_server.js')
-rw-r--r-- | background/message_server.js | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/background/message_server.js b/background/message_server.js index 358e9d5..a541a04 100644 --- a/background/message_server.js +++ b/background/message_server.js @@ -5,28 +5,33 @@ * Redistribution terms are gathered in the `copyright' file. */ -"use strict"; - -(() => { - const browser = window.browser; +/* + * IMPORTS_START + * IMPORT browser + * IMPORTS_END + */ - var listeners = {}; +var listeners = {}; - /* magic should be one of the constants from /common/connection_types.js */ +/* magic should be one of the constants from /common/connection_types.js */ - function listen_for_connection(magic, cb) - { - listeners[magic] = cb; - } +function listen_for_connection(magic, cb) +{ + listeners[magic] = cb; +} - function raw_listen(port) { - if (listeners[port.name] === undefined) - return; +function raw_listen(port) +{ + if (listeners[port.name] === undefined) + return; - listeners[port.name](port); - } + listeners[port.name](port); +} - browser.runtime.onConnect.addListener(raw_listen); +browser.runtime.onConnect.addListener(raw_listen); - window.listen_for_connection = listen_for_connection; -})(); +/* + * EXPORTS_START + * EXPORT listen_for_connection + * EXPORTS_END + */ |