Type Alias InitStreamOptions

InitStreamOptions: {
    debugLabel: string;
    onDispose: ((reason: string) => void);
    onFirstSubscribe: (() => void);
    onNoSubscribers: (() => void);
}

Type declaration

  • debugLabel: string

    Optional label to associate with this stream. Useful for debugging.

  • onDispose: ((reason: string) => void)

    Called whenever the stream disposes. Useful for cleaning up.

      • (reason): void
      • Parameters

        • reason: string

        Returns void

  • onFirstSubscribe: (() => void)

    Called when there is a subscriber after there were no subscribers. Useful for 'startup' types of things that we want to run only when someone is actually listening.

    During the lifeycle of a stream, this could be called multiple times. Eg if all subscribers are removed next time someone subscribes it will get called again.

      • (): void
      • Returns void

  • onNoSubscribers: (() => void)

    Called when there are no longer any subscribers. Useful for shutting down activities now that no-one is listening.

    During the lifecycle of a stream, this could be called multiple times.

      • (): void
      • Returns void