@types/fibers
- Version 3.1.4
- Published
- 12.8 kB
- No dependencies
- MIT license
Install
npm i @types/fibers
yarn add @types/fibers
pnpm add @types/fibers
Overview
TypeScript definitions for fibers
Index
Variables
Interfaces
Variables
variable Fiber
const Fiber: FiberConstructor;
Interfaces
interface Fiber
interface Fiber {}
method reset
reset: <T = any>() => T;
reset() will terminate a running Fiber and restore it to its original state, as if it had returned execution.
This is accomplished by causing yield() to throw an exception, and any futher calls to yield() will also throw an exception. This continues until the fiber has completely unwound and returns.
If the fiber returns a value it will be returned by reset().
If the fiber is not running, reset() will have no effect.
method run
run: <T = any, R = any>(param?: T) => R;
run() will start execution of this Fiber, or if it is currently yielding, it will resume execution. If an argument is supplied, this argument will be passed to the fiber, either as the first parameter to the main function [if the fiber has not been started] or as the return value of yield() [if the fiber is currently yielding].
This function will return either the parameter passed to yield(), or the returned value from the fiber's main function.
method throwInto
throwInto: (exception: Error) => void;
throwInto() will cause a currently yielding fiber's yield() call to throw instead of return gracefully. This can be useful for notifying a fiber that you are no longer interested in its task, and that it should give up.
Note that if the fiber does not handle the exception it will continue to bubble up and throwInto() will throw the exception right back at you.
Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/fibers
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/fibers)
- HTML<a href="https://www.jsdocs.io/package/@types/fibers"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3489 ms. - Missing or incorrect documentation? Open an issue for this package.