Skip to content

JS: TypeError: Cannot read property 'nextTick' of undefined #1404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
webleaf opened this issue Aug 3, 2019 · 4 comments
Closed

JS: TypeError: Cannot read property 'nextTick' of undefined #1404

webleaf opened this issue Aug 3, 2019 · 4 comments
Labels

Comments

@webleaf
Copy link

webleaf commented Aug 3, 2019

TypeError: Cannot read property 'nextTick' of undefined

I've got this error on 1.3.0+. All works until 1.2.2.
I use JS environment different from node.js and browser (mobile js framework NativeScript). There are no window and there are no process. (seems related with #1027 #820)


And seems like in 1.3.0+ kotlinx-coroutines-core introduce some changes that rely on the assumption that besides node.js and browser there is no other JS environments.
How can I use coroutines in just general JS environment now?

@qwwdfsad
Copy link
Collaborator

qwwdfsad commented Aug 3, 2019

It looks like on NativeScript only setTimeout is present as the dispatch mechanism.
Could you please share a reproducing project? I am mostly interested in setuping NativeScript for KotlinJS + kotlinx-coroutines

@webleaf
Copy link
Author

webleaf commented Aug 3, 2019

@qwwdfsad reproducing project: issue1404.zip

It looks like on NativeScript only setTimeout is present as the dispatch mechanism.

Does it means until 1.2.2 it worked for me based on setTimeout/cleareTimeout? Because it seemed to worked pretty well, despite the fact that setTimeout/clearTimeout is not js-engine functions, but wrappers of platform specific implementations (Android/iOS) (such platform calls may have micro-delays in NativeScript)

Will this bug be fixed in 1.3.0?

qwwdfsad added a commit that referenced this issue Aug 5, 2019
@qwwdfsad
Copy link
Collaborator

qwwdfsad commented Aug 5, 2019

Does it means until 1.2.2 it worked for me based on setTimeout/cleareTimeout

Yes.

Will this bug be fixed in 1.3.0?

Most likely

Thanks for the sample project, it was really helpful and saved a lot of time!

@webleaf
Copy link
Author

webleaf commented Aug 5, 2019

Thanks a lot for fast reaction (really did not want to get stuck with 1.2.2 and Kotlin 1.3.40)

Woot! Nifty! Superb! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
@webleaf @qwwdfsad and others