Skip to content

useThread 0.1.0 view source

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

Spawns a new thread that is cancelled 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 thread with.


Returns -> thread

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


Example Usage

-- TODO: write example