Skip to content

useCoroutine 0.1.0 view source

function useCoroutine<Args...>(
  scope: Fusion.Scope,
  resume: thread | (Args...) -> (),
  ...: Args...
): thread

Spawns a new coroutine that is closed once the scope is cleaned up.


Parameters

scope : Fusion.Scope

The scope to store clean up tasks.

resume : thread | (Args...) -> ()

The thread to resume, or a function to spawn.

... : Args...

The arguments to spawn the coroutine with.


Returns -> thread

A thread that is closed once the scope is cleaned up.


Example Usage

  -- TODO: write example