Starter.start()method
Run the start callback (once).
start(...values: T): void
new Starter<T>(start: StartCallback<T>)
| Param | Type | |
|---|---|---|
start | StartCallback<T> | The callback to run on start(), which may return a stop callback. required |
| Return | |
|---|---|
Starter<T> | Wrapper class to handle state on start/stop callback process. |
Wrapper class to handle state on start/stop callback process.
starter.start() won't be called twice (including if start() didn't return a stop() callback).Disposable so it can be used with using, calling stop() on disposal.const starter = new Starter(() => { console.log("start"); return () => console.log("stop"); });
starter.start();
starter.stop();Run the start callback (once).
start(...values: T): void
Run the stop callback (if one was returned by the start callback).
stop(): void