Anyone ever used manual coroutines in javascript w...
# javascript
f
Anyone ever used manual coroutines in javascript where you manually dispatch the resume method? E.g. to accomplish some sort of fake multithreading?
v
I don’t quite get what you mean, but I’ve definitely used
suspendCoroutine
/
resume
/
resumeWithException
so the code looks much easier to read. Sample: https://github.com/burrunan/gradle-cache-action/blob/1b47ef06a2ad8034f3638d2eae8130d29025fa2f/wrappers/nodejs/src/main/kotlin/com/github/burrunan/wrappers/nodejs/FsExtensions.kt#L27-L30 Now
exists(…)
method can be used as a regular suspending method in Kotlin, and no await or whatever is needed. It works like
if (exists(…)) {…
Is it what you ask?