diff options
Diffstat (limited to 'ext/mixed/js')
-rw-r--r-- | ext/mixed/js/core.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ext/mixed/js/core.js b/ext/mixed/js/core.js index b9536391..36056c36 100644 --- a/ext/mixed/js/core.js +++ b/ext/mixed/js/core.js @@ -225,3 +225,21 @@ class EventDispatcher { return false; } } + + +/* + * Default message handlers + */ + +(() => { + function onMessage({action}, sender, callback) { + switch (action) { + case 'getUrl': + callback({url: window.location.href}); + break; + } + return false; + } + + chrome.runtime.onMessage.addListener(onMessage); +})(); |