Files
webextensions-examples/mocha-client-tests/addon/background.js
rebloor 82217a05bc Replace var with let in examples (#484)
* Replace var with let in examples

store-collected-images/webextension-plain/deps/uuidv4.js

* Reverted third–party code
2022-08-11 04:27:28 +12:00

16 lines
506 B
JavaScript

let Background = {
receiveMessage: function(msg, sender, sendResponse) {
if (msg && msg.action && Background.hasOwnProperty(msg.action)) {
return Background[msg.action](msg, sender, sendResponse);
} else {
console.warn('No handler for message: ' + JSON.stringify(msg));
}
},
ping: function(msg, sender, sendResponse) {
sendResponse('pong');
return true;
}
};
browser.runtime.onMessage.addListener(Background.receiveMessage);