Hello, how i can create Kotlin job and start it la...
# coroutines
a
Hello, how i can create Kotlin job and start it later?
m
Explain the employer that you need time to leave you current job 😄
🤔 2
g
You can create lazy job using
start
param in launch/async
To start use start() function or join()/await()
a
@gildor something like:
Copy code
fun startUpdate(): Lazy<Job> {
    return lazy {
        GlobalScope.launch {
            hierachyUpdater.doUpdate()
        }
    }
}
?
g
No
As I said, there is
start
param in launch/async functions
Check docs of launch/async
a
@gildor thx 🙂
Copy code
fun startUpdate() = GlobalScope.launch(start = CoroutineStart.LAZY) {
    hierachyUpdater.doUpdate()
}
âž• 1
g
Yes, this is what I meant. But I wouldn't use GlobalScope