Sanity Library Reference Docs
    Preparing search index...

    Interface MessageBusEmitResult<R>

    A lazily awaited event reply.

    interface MessageBusEmitResult<R> {
        catch<T = never>(
            onRejected?: (reason: unknown) => T | PromiseLike<T>,
        ): Promise<R | T>;
        finally(onFinally?: () => void): Promise<R>;
        then<TResult1 = R, TResult2 = never>(
            onfulfilled?: ((value: R) => TResult1 | PromiseLike<TResult1>) | null,
            onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,
        ): PromiseLike<TResult1 | TResult2>;
    }

    Type Parameters

    • R

    Hierarchy

    • PromiseLike<R>
      • MessageBusEmitResult
    Index

    Methods

    • Handles a rejected event reply.

      Type Parameters

      • T = never

      Parameters

      • OptionalonRejected: (reason: unknown) => T | PromiseLike<T>

      Returns Promise<R | T>

    • Attaches callbacks for the resolution and/or rejection of the Promise.

      Type Parameters

      • TResult1 = R
      • TResult2 = never

      Parameters

      • Optionalonfulfilled: ((value: R) => TResult1 | PromiseLike<TResult1>) | null

        The callback to execute when the Promise is resolved.

      • Optionalonrejected: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null

        The callback to execute when the Promise is rejected.

      Returns PromiseLike<TResult1 | TResult2>

      A Promise for the completion of which ever callback is executed.