File tree 1 file changed +12
-6
lines changed
core/src/main/scala/org/scalajs/macrotaskexecutor
1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,18 @@ object MacrotaskExecutor extends ExecutionContextExecutor {
43
43
}
44
44
45
45
private [this ] val setImmediate : Runnable => Unit = {
46
- if (js.typeOf(js.Dynamic .global.setImmediate) == Undefined ) {
46
+ if (js.typeOf(js.Dynamic .global.setImmediate) != Undefined ) {
47
+ { k =>
48
+ js.Dynamic .global.setImmediate(() => k.run())
49
+ ()
50
+ }
51
+ } else if (js.typeOf(js.Dynamic .global.scheduler) != Undefined
52
+ && js.typeOf(js.Dynamic .global.scheduler.postTask) != Undefined ) {
53
+ { k =>
54
+ js.Dynamic .global.scheduler.postTask(() => k.run())
55
+ ()
56
+ }
57
+ } else {
47
58
var nextHandle = 1
48
59
val tasksByHandle = (new js.Object ).asInstanceOf [TaskMap ]
49
60
var currentlyRunningATask = false
@@ -161,11 +172,6 @@ object MacrotaskExecutor extends ExecutionContextExecutor {
161
172
()
162
173
}
163
174
}
164
- } else {
165
- { k =>
166
- js.Dynamic .global.setImmediate(() => k.run())
167
- ()
168
- }
169
175
}
170
176
}
171
177
You can’t perform that action at this time.
0 commit comments