Skip to content

Commit b01f69a

Browse files
authored
Replace setImmediate with setTimeout 0 (#14)
1 parent cf57429 commit b01f69a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/XMLHttpRequest.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -636,14 +636,14 @@ function XMLHttpRequest(opts) {
636636
this.dispatchEvent = function (event) {
637637
if (typeof self["on" + event] === "function") {
638638
if (this.readyState === this.DONE && settings.async)
639-
setImmediate(function() { self["on" + event]() })
639+
setTimeout(function() { self["on" + event]() }, 0)
640640
else
641641
self["on" + event]()
642642
}
643643
if (event in listeners) {
644644
for (let i = 0, len = listeners[event].length; i < len; i++) {
645645
if (this.readyState === this.DONE)
646-
setImmediate(function() { listeners[event][i].call(self) })
646+
setTimeout(function() { listeners[event][i].call(self) }, 0)
647647
else
648648
listeners[event][i].call(self)
649649
}

0 commit comments

Comments
 (0)