Library API
    Preparing search index...

    Class Pledge<T>

    A lightweight wrapper around Promises (utilizing Promise.withResolvers) that exposes resolve, reject, and state-tracking methods. Useful for deferred execution and managing asynchronous lifecycles.

    const p = new Pledge`<string>`('MyPledge');
    p.resolve('Success!');
    await p.promise; // 'Success!'

    Type Parameters

    • T
    Index
    isPledge: PledgeTypeGuard

    Type guard to check if a value is an authentic Pledge instance

    • Bridges this Pledge into a synchronous Signify signal. While pending, returns the optional defaultValue (default: undefined). When resolved, reactively returns the resolved value. If rejected, the signal rethrows the rejection error upon access.

      Type Parameters

      • D = undefined

      Parameters

      • OptionaldefaultValue: D

        Optional fallback value returned while pending.

      Returns ReadonlySignal<T | D>

      A ReadonlySignal bound to this pledge's resolution.