Skip to content

Commit 58cd518

Browse files
committed
Try to fixed can't find setTImeout in webpack
1 parent 06d5455 commit 58cd518

6 files changed

Lines changed: 16 additions & 16 deletions

File tree

dist/hprose.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/hprose.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/hprose.src.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@
15391539
* *
15401540
* setImmediate for JavaScript. *
15411541
* *
1542-
* LastModified: Mar 2, 2016 *
1542+
* LastModified: Sep 28, 2016 *
15431543
* Author: Ma Bingyao <andot@hprose.com> *
15441544
* *
15451545
\**********************************************************/
@@ -1664,18 +1664,18 @@
16641664
};
16651665
};
16661666

1667+
// If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
1668+
var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
1669+
attachTo = (attachTo && attachTo.setTimeout ? attachTo : global);
1670+
16671671
polifill.setTimeout = function() {
16681672
return function() {
16691673
var handleId = create(arguments);
1670-
global.setTimeout( wrap( run, handleId ), 0 );
1674+
attachTo.setTimeout( wrap( run, handleId ), 0 );
16711675
return handleId;
16721676
};
16731677
};
16741678

1675-
// If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
1676-
var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
1677-
attachTo = (attachTo && attachTo.setTimeout ? attachTo : global);
1678-
16791679
// Don't get fooled by e.g. browserify environments.
16801680
// For Node.js before 0.9
16811681
if (typeof(global.process) !== 'undefined' &&

example/hprose.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/setImmediate.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* *
1414
* setImmediate for JavaScript. *
1515
* *
16-
* LastModified: Mar 2, 2016 *
16+
* LastModified: Sep 28, 2016 *
1717
* Author: Ma Bingyao <andot@hprose.com> *
1818
* *
1919
\**********************************************************/
@@ -138,18 +138,18 @@
138138
};
139139
};
140140

141+
// If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
142+
var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
143+
attachTo = (attachTo && attachTo.setTimeout ? attachTo : global);
144+
141145
polifill.setTimeout = function() {
142146
return function() {
143147
var handleId = create(arguments);
144-
global.setTimeout( wrap( run, handleId ), 0 );
148+
attachTo.setTimeout( wrap( run, handleId ), 0 );
145149
return handleId;
146150
};
147151
};
148152

149-
// If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
150-
var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
151-
attachTo = (attachTo && attachTo.setTimeout ? attachTo : global);
152-
153153
// Don't get fooled by e.g. browserify environments.
154154
// For Node.js before 0.9
155155
if (typeof(global.process) !== 'undefined' &&

test/hprose.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)