/** * Myext message server * * Copyright (C) 2021 Wojtek Kosior * Redistribution terms are gathered in the `copyright' file. */ "use strict"; (() => { const browser = window.browser; var listeners = {}; /* magic should be one of the constants from /common/connection_types.js */ function listen_for_connection(magic, cb) { listeners[magic] = cb; } function raw_listen(port) { if (listeners[port.name] === undefined) return; listeners[port.name](port); } browser.runtime.onConnect.addListener(raw_listen); window.listen_for_connection = listen_for_connection; })();