Documents injecute 1.x · Migrating from 0.x
Skip to content

Function: startSignal() ​

startSignal(): AbortSignalLike

Defined in: src/utils/lifecycle.ts:649

A dependency that gives a lifecycle hook the start signal: the signal passed to startLifecycle(), which aborts when the start takes too long. Pass it on to the work the hook waits for (a connection, a request), so that work stops too. Outside a start, and without a signal option, it never aborts.

Returns ​

AbortSignalLike

Example ​

ts
app.addSingleton(
  lifecycle.init('config'),
  async (client, signal) => {
    await client.load({ signal }); // cancelled when the start times out
  },
  ['configClient', startSignal],
);

await startLifecycle(app, { signal: AbortSignal.timeout(30_000) });

Released under the MIT License.