Harmless

    A destroyable context hierarchy.

    Implements

    • SignalContext
    • Destroyable
    Index

    Constructors

    • Creates a new context and registers it as destroyable in the current context so the new context is destroyed when the parent context is destroyed.

      Returns Context

    Methods

    • Destroys this context. This unregisters the context from its parent context and destroys all destroyables registered within this context.

      Returns void

    • Registers the given destroyable to be destroyed when this context is destroyed.

      Parameters

      • destroyable: Destroyable

        The destroyable to register.

      Returns void

    • Runs the given function within this context. New contexts created in this function are automatically registered as child context within this context so they are destroyed when this context is destroyed. Note that this cannot work when the function is asynchronous.

      Type Parameters

      • T

      Parameters

      • fn: () => T

        The function to run within this context.

      Returns T

      The return value of the called function.

    • Unregisters a destroyable which was previously registered with registerDestroyable.

      Parameters

      • destroyable: Destroyable

        The destroyable to unregister.

      Returns void

    • Returns null | Context

      The current context or null if none.

    MMNEPVFCICPMFPCPTTAAATR