Closed catvir closed 9 years ago
The await does not work with code blocks that are also using await. The following example shows the issue:
await console.log 1 await setTimeout defer(), 5000 console.log 2 setTimeout defer(), 5000 console.log 3 console.log 4
i'd expect it to make two pauses, one after 1, and one after 3. Only one pause happens, the one after 3, where it waits for both timers to finish and results in deadlock messages. Is this a bug or are nested awaits considered to be bad-practice?
This structure/syntax isn't supported, but you can achieve the same ends with function nesting.
The await does not work with code blocks that are also using await. The following example shows the issue:
i'd expect it to make two pauses, one after 1, and one after 3. Only one pause happens, the one after 3, where it waits for both timers to finish and results in deadlock messages. Is this a bug or are nested awaits considered to be bad-practice?