Reuben F
10/18/2021, 12:58 PM@Test
fun example() {
var i = 0
fun asyncTask() = Promise<Boolean> { resolve, _ ->
window.setTimeout({ i = 1; resolve(true) }, 100)
}
asyncTask().then {
console.log("got result")
} // there's no await so i can't prevent it continuing
console.log("i want this to run after we've waited for the promise")
assertEquals(i, 1)
}
ephemient
10/18/2021, 1:03 PMReuben F
10/18/2021, 1:06 PM