diff options
Diffstat (limited to 'e2e/ambassador/src/background/tabs.js')
-rw-r--r-- | e2e/ambassador/src/background/tabs.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/e2e/ambassador/src/background/tabs.js b/e2e/ambassador/src/background/tabs.js new file mode 100644 index 0000000..93d47a3 --- /dev/null +++ b/e2e/ambassador/src/background/tabs.js @@ -0,0 +1,18 @@ +const create = (props = {}) => { + return new Promise((resolve) => { + browser.tabs.create(props).then((createdTab) => { + let callback = (tabId, changeInfo, tab) => { + if (tab.url !== 'about:blank' && tabId === createdTab.id && + changeInfo.status === 'complete') { + browser.tabs.onUpdated.removeListener(callback); + resolve(tab); + } + }; + browser.tabs.onUpdated.addListener(callback); + }); + }); +}; + +export { + create, +}; |