mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Reduced direct dependency on browser.xxx APIs
This commit is contained in:
parent
a9edf45aa8
commit
137c1688ba
7 changed files with 53 additions and 14 deletions
34
lib/extension.js
Normal file
34
lib/extension.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
var scope;
|
||||
if ((typeof exports) !== "undefined"){
|
||||
scope = exports;
|
||||
}
|
||||
else {
|
||||
scope = require.register("./extension", {});
|
||||
}
|
||||
|
||||
scope.getTranslation = function getTranslation(id){
|
||||
return browser.i18n.getMessage(id);
|
||||
};
|
||||
|
||||
scope.extensionID = browser.extension.getURL("");
|
||||
|
||||
scope.inIncognitoContext = browser.extension.inIncognitoContext;
|
||||
|
||||
scope.message = {
|
||||
on: function(callback){
|
||||
return browser.runtime.onMessage.addListener(callback);
|
||||
},
|
||||
send: function(data){
|
||||
return browser.runtime.sendMessage(data);
|
||||
}
|
||||
};
|
||||
Object.seal(scope.message);
|
||||
|
||||
Object.seal(scope);
|
||||
}());
|
Loading…
Add table
Add a link
Reference in a new issue