1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-02 06:07:06 +01:00
metamask-extension/app/vendor/trezor/usb-permissions.js
2018-08-05 03:17:51 -04:00

21 lines
571 B
JavaScript

/*
Handling messages from usb permissions iframe
*/
window.addEventListener('message', event => {
if (event.data === 'usb-permissions-init') {
const iframe = document.getElementById('trezor-usb-permissions');
iframe.contentWindow.postMessage({
type: 'usb-permissions-init',
extension: chrome.runtime.id,
}, '*');
} else if (event.data === 'usb-permissions-close') {
chrome.tabs.query({
currentWindow: true,
active: true,
}, (tabs) => {
chrome.tabs.remove(tabs[0].id);
});
}
});