Changeset View
Changeset View
Standalone View
Standalone View
extension/extension-utils.js
Show All 19 Lines | |||||
20 | var callbacks = {}; // TODO rename to "portCallbacks"? | 20 | var callbacks = {}; // TODO rename to "portCallbacks"? | ||
21 | var runtimeCallbacks = {}; | 21 | var runtimeCallbacks = {}; | ||
22 | 22 | | |||
23 | let currentMessageSerial = 0; | 23 | let currentMessageSerial = 0; | ||
24 | let pendingMessageReplyResolvers = {}; | 24 | let pendingMessageReplyResolvers = {}; | ||
25 | 25 | | |||
26 | var storage = (IS_FIREFOX ? chrome.storage.local : chrome.storage.sync); | 26 | var storage = (IS_FIREFOX ? chrome.storage.local : chrome.storage.sync); | ||
27 | 27 | | |||
28 | let firefoxVersionMatch = navigator.userAgent.match(/Firefox\/(\d+)/) | | |||
davidedmundson: may as well keep this? | |||||
29 | let firefoxVersion = firefoxVersionMatch ? Number(firefoxVersionMatch[1]) : NaN | | |||
30 | | ||||
31 | // Callback is called with following arguments (in that order); | 28 | // Callback is called with following arguments (in that order); | ||
32 | // - The actual message data/payload | 29 | // - The actual message data/payload | ||
33 | // - The name of the action triggered | 30 | // - The name of the action triggered | ||
34 | function addCallback(subsystem, action, callback) // TODO rename to "addPortCallbacks"? | 31 | function addCallback(subsystem, action, callback) // TODO rename to "addPortCallbacks"? | ||
35 | { | 32 | { | ||
36 | if (Array.isArray(action)) { | 33 | if (Array.isArray(action)) { | ||
37 | action.forEach(function(item) { | 34 | action.forEach(function(item) { | ||
38 | addCallback(subsystem, item, callback); | 35 | addCallback(subsystem, item, callback); | ||
▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines |
may as well keep this?