platform-bible-utils
    Preparing search index...

    Class UnsubscriberAsyncList

    Simple collection for UnsubscriberAsync objects that also provides an easy way to run them.

    A list is single-use: it collects unsubscribers until runAllUnsubscribers runs them, and that run seals it for good. Anything added to a sealed list is unsubscribed immediately instead of being stored, because whatever these clean up after is already gone. Registration is usually asynchronous, so an unsubscriber routinely arrives after the teardown that should have run it — without sealing it would be stored in a list nobody drains again and its subscription would leak for the rest of the session.

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    unsubscribers: Set<Unsubscriber | UnsubscriberAsync> = ...

    Methods

    • Run all unsubscribers added to this list, clear the list, and seal it so anything added later is unsubscribed on arrival.

      An unsubscriber that throws (synchronously or asynchronously) does not make this method reject: the error is caught and logged via console.error, the remaining unsubscribers still run, and the thrower counts as a failure in the return value. An unsubscriber that arrives during the run is not part of the returned result — nothing is waiting on it by then.

      Returns Promise<boolean>

      true if all unsubscribers succeeded, false if any returned false or threw.