File tree Expand file tree Collapse file tree 1 file changed +1
-7
lines changed
kotlinx-coroutines-core/js/src Expand file tree Collapse file tree 1 file changed +1
-7
lines changed Original file line number Diff line number Diff line change @@ -13,12 +13,6 @@ private const val UNDEFINED = "undefined"
13
13
internal external val process: dynamic
14
14
15
15
internal actual fun createDefaultDispatcher (): CoroutineDispatcher = when {
16
- // Check if we are running under ReactNative. We have to use NodeDispatcher under it.
17
- // The problem is that ReactNative has a `window` object with `addEventListener`, but it does not really work.
18
- // For details see https://github.com/Kotlin/kotlinx.coroutines/issues/236
19
- // The check for ReactNative is based on https://github.com/facebook/react-native/commit/3c65e62183ce05893be0822da217cb803b121c61
20
- jsTypeOf(navigator) != UNDEFINED && navigator != null && navigator.product == " ReactNative" ->
21
- NodeDispatcher
22
16
// Check if we are running under jsdom. WindowDispatcher doesn't work under jsdom because it accesses MessageEvent#source.
23
17
// It is not implemented in jsdom, see https://github.com/jsdom/jsdom/blob/master/Changelog.md
24
18
// "It's missing a few semantics, especially around origins, as well as MessageEvent source."
@@ -27,7 +21,7 @@ internal actual fun createDefaultDispatcher(): CoroutineDispatcher = when {
27
21
jsTypeOf(window) != UNDEFINED && window.asDynamic() != null && jsTypeOf(window.asDynamic().addEventListener) != UNDEFINED ->
28
22
window.asCoroutineDispatcher()
29
23
// If process is undefined (e.g. in NativeScript, #1404), use SetTimeout-based dispatcher
30
- jsTypeOf(process) == UNDEFINED -> SetTimeoutDispatcher
24
+ jsTypeOf(process) == UNDEFINED || jsTypeOf(process.nextTick) == UNDEFINED -> SetTimeoutDispatcher
31
25
// Fallback to NodeDispatcher when browser environment is not detected
32
26
else -> NodeDispatcher
33
27
}
You can’t perform that action at this time.
0 commit comments