mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-17 06:48:37 +02:00
* Replace var with let in examples store-collected-images/webextension-plain/deps/uuidv4.js * Reverted third–party code
16 lines
506 B
JavaScript
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);
|