Skip to content

Commit

Permalink
fix: window.close
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Works committed Aug 6, 2019
1 parent bd3b8c7 commit 41c0286
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/setup.ts
Expand Up @@ -8,4 +8,15 @@ export function backgroundSetup() {
import { activateSocialNetworkUI } from './social-network/ui'
export function uiSetup() {
activateSocialNetworkUI()

if (typeof browser !== 'undefined' && browser.tabs && browser.tabs.query && browser.tabs.remove) {
const close = window.close
window.close = () => {
Reflect.apply(close, window, [])
setTimeout(async () => {
const { id } = await browser.tabs.getCurrent()
id && (await browser.tabs.remove(id))
}, 400)
}
}
}

0 comments on commit 41c0286

Please sign in to comment.