File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,15 @@ var callbacks;
30
30
31
31
function empty ( ) { }
32
32
33
+ /**
34
+ * Until https://github.com/tc39/proposal-global is shipped.
35
+ */
36
+ function glob ( ) {
37
+ return typeof self !== 'undefined' ? self
38
+ : typeof window !== 'undefined' ? window
39
+ : typeof global !== 'undefined' ? global : { } ;
40
+ }
41
+
33
42
/**
34
43
* JSONP Polling constructor.
35
44
*
@@ -46,8 +55,8 @@ function JSONPPolling (opts) {
46
55
// we do this here (lazily) to avoid unneeded global pollution
47
56
if ( ! callbacks ) {
48
57
// we need to consider multiple engines in the same page
49
- if ( ! window . ___eio ) window . ___eio = [ ] ;
50
- callbacks = window . ___eio ;
58
+ var global = glob ( ) ;
59
+ callbacks = global . ___eio = ( global . ___eio || [ ] ) ;
51
60
}
52
61
53
62
// callback identifier
You can’t perform that action at this time.
0 commit comments