diff --git a/engine.io.js b/engine.io.js index 6c0b575e2..76f74851d 100644 --- a/engine.io.js +++ b/engine.io.js @@ -1345,7 +1345,8 @@ return /******/ (function(modules) { // webpackBootstrap if (typeof attachEvent === 'function') { attachEvent('onunload', unloadHandler); } else if (typeof addEventListener === 'function') { - addEventListener('beforeunload', unloadHandler, false); + var terminationEvent = 'onpagehide' in self ? 'pagehide' : 'unload'; + addEventListener(terminationEvent, unloadHandler, false); } } @@ -4039,7 +4040,7 @@ return /******/ (function(modules) { // webpackBootstrap /* 25 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; /** * Module requirements. @@ -4073,6 +4074,13 @@ return /******/ (function(modules) { // webpackBootstrap function empty() {} + /** + * Until https://github.com/tc39/proposal-global is shipped. + */ + function glob() { + return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {}; + } + /** * JSONP Polling constructor. * @@ -4089,8 +4097,8 @@ return /******/ (function(modules) { // webpackBootstrap // we do this here (lazily) to avoid unneeded global pollution if (!callbacks) { // we need to consider multiple engines in the same page - if (!window.___eio) window.___eio = []; - callbacks = window.___eio; + var global = glob(); + callbacks = global.___eio = global.___eio || []; } // callback identifier @@ -4271,6 +4279,7 @@ return /******/ (function(modules) { // webpackBootstrap this.iframe.onload = complete; } }; + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 26 */ diff --git a/package.json b/package.json index cf6b0b3de..004b1130d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "engine.io-client", "description": "Client for the realtime Engine", "license": "MIT", - "version": "3.3.0", + "version": "3.3.1", "main": "lib/index.js", "homepage": "https://github.com/socketio/engine.io-client", "contributors": [ @@ -45,7 +45,7 @@ "concat-stream": "^1.6.0", "del": "^2.2.2", "derequire": "^2.0.6", - "engine.io": "3.3.0", + "engine.io": "3.3.1", "eslint-config-standard": "4.4.0", "eslint-plugin-standard": "1.3.1", "expect.js": "^0.3.1",