1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-29 17:38:04 +01:00

listen to messages from BrowserApi

This commit is contained in:
Kyle Spearrin 2018-01-12 15:29:01 -05:00
parent 497984e353
commit 06c8f17d06
2 changed files with 9 additions and 11 deletions

View File

@ -42,15 +42,6 @@ export default class RuntimeBackground {
}
}, true);
this.runtime.addEventListener('message', async (msgEvent: any) => {
await this.processMessage(msgEvent.message, {
tab: {
id: null, // TODO
},
frameId: null,
}, () => { /* No responses in Safari */ });
}, false);
return;
}
@ -67,7 +58,7 @@ export default class RuntimeBackground {
});
}
this.runtime.onMessage.addListener(async (msg: any, sender: any, sendResponse: any) => {
BrowserApi.messageListener(async (msg: any, sender: any, sendResponse: any) => {
await this.processMessage(msg, sender, sendResponse);
});
}

View File

@ -167,7 +167,14 @@ class BrowserApi {
callback(msg, sender, response);
});
} else if (BrowserApi.isSafariApi) {
// TODO
safari.application.addEventListener('message', async (msgEvent: any) => {
callback(msgEvent.message, {
tab: {
id: null, // TODO
},
frameId: null,
}, () => { /* No responses in Safari */ });
}, false);
}
}
}