summaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/driver.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js
index 16b12d5e..5e17537e 100644
--- a/ext/fg/js/driver.js
+++ b/ext/fg/js/driver.js
@@ -35,6 +35,7 @@ window.driver = new class {
window.addEventListener('mouseup', this.onMouseUp.bind(this));
window.addEventListener('mousemove', this.onMouseMove.bind(this));
window.addEventListener('resize', e => this.searchClear());
+ window.addEventListener('message', this.onFrameMessage.bind(this));
chrome.runtime.onMessage.addListener(this.onBgMessage.bind(this));
}).catch(this.handleError.bind(this));
}
@@ -101,6 +102,27 @@ window.driver = new class {
}
}
+ onFrameMessage(e) {
+ const handlers = {
+ popupClose: () => {
+ this.searchClear();
+ },
+
+ scanLeft: () => {
+
+ },
+
+ scanRight: () => {
+
+ }
+ };
+
+ const handler = handlers[e.data];
+ if (handler) {
+ handler();
+ }
+ }
+
onBgMessage({action, params}, sender, callback) {
const handlers = new class {
api_optionsSet(options) {