()
| 7 | * Get a reference to the current thread. |
| 8 | */ |
| 9 | export function useThread(): Thread { |
| 10 | const thread = ThreadStack.at(-1); |
| 11 | if (!thread) { |
| 12 | throw new DetailedError( |
| 13 | 'The thread is not available in the current context.', |
| 14 | // language=markdown |
| 15 | `\`useThread()\` can only be called from within generator functions. |
| 16 | It's not available during rendering.`, |
| 17 | ); |
| 18 | } |
| 19 | return thread; |
| 20 | } |
| 21 | |
| 22 | export function startThread(thread: Thread) { |
| 23 | ThreadStack.push(thread); |
no outgoing calls
no test coverage detected