Skip to content

Commit

Permalink
Merge pull request #701 from john-e-riordan/dev-master
Browse files Browse the repository at this point in the history
Feature check for presence of 'window' global
  • Loading branch information
James Criscuolo authored Jun 18, 2019
2 parents 63beabf + 6c02f93 commit 67b51c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/UA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ export class UA extends EventEmitter {
if (this.configuration.autostop) {
// Google Chrome Packaged Apps don't allow 'unload' listeners: unload is not available in packaged apps
const googleChromePackagedApp = typeof chrome !== "undefined" && chrome.app && chrome.app.runtime ? true : false;
if (window && !googleChromePackagedApp) {
if (typeof window !== "undefined" && !googleChromePackagedApp) {
window.removeEventListener("unload", this.unloadListener);
}
}
Expand Down Expand Up @@ -590,7 +590,7 @@ export class UA extends EventEmitter {
if (this.configuration.autostop) {
// Google Chrome Packaged Apps don't allow 'unload' listeners: unload is not available in packaged apps
const googleChromePackagedApp = typeof chrome !== "undefined" && chrome.app && chrome.app.runtime ? true : false;
if (window && !googleChromePackagedApp) {
if (typeof window !== "undefined" && !googleChromePackagedApp) {
window.addEventListener("unload", this.unloadListener);
}
}
Expand Down

0 comments on commit 67b51c3

Please sign in to comment.