summaryrefslogtreecommitdiffstats
path: root/platform/chromium/webext.js
diff options
context:
space:
mode:
Diffstat (limited to 'platform/chromium/webext.js')
-rw-r--r--platform/chromium/webext.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/platform/chromium/webext.js b/platform/chromium/webext.js
index 851b653..f044649 100644
--- a/platform/chromium/webext.js
+++ b/platform/chromium/webext.js
@@ -19,8 +19,6 @@
Home: https://github.com/gorhill/uBlock
*/
-'use strict';
-
// `webext` is a promisified api of `chrome`. Entries are added as
// the promisification of uBO progress.
@@ -54,6 +52,15 @@ const promisify = function(thisArg, fnName) {
};
const webext = {
+ // https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/alarms
+ alarms: {
+ clear: promisifyNoFail(chrome.alarms, 'clear'),
+ clearAll: promisifyNoFail(chrome.alarms, 'clearAll'),
+ create: promisifyNoFail(chrome.alarms, 'create'),
+ get: promisifyNoFail(chrome.alarms, 'get'),
+ getAll: promisifyNoFail(chrome.alarms, 'getAll'),
+ onAlarm: chrome.alarms.onAlarm,
+ },
// https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browserAction
browserAction: {
setBadgeBackgroundColor: promisifyNoFail(chrome.browserAction, 'setBadgeBackgroundColor'),
@@ -95,6 +102,7 @@ const webext = {
query: promisifyNoFail(chrome.tabs, 'query', tabs => Array.isArray(tabs) ? tabs : []),
reload: promisifyNoFail(chrome.tabs, 'reload'),
remove: promisifyNoFail(chrome.tabs, 'remove'),
+ sendMessage: promisifyNoFail(chrome.tabs, 'sendMessage'),
update: promisifyNoFail(chrome.tabs, 'update', tab => tab instanceof Object ? tab : null),
},
// https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webNavigation