lev.spawn

lev

spawn(fn, opts) -> task

Spawn a new concurrent task

Spawns fn as a new coroutine that runs concurrently within the current lev.run() event loop. Returns a task handle that can be passed to await().

Options:

Raises outside lev.run(), and when fn is not a function.