Function waitForWatch

  • Waits for a watcher to match, and resolves with the value.

    Type Parameters

    • T

    Parameters

    • ctx: Context
    • spec: WaitForWatchSpec<T>

    Returns Promise<T>

    Example

    const options: WaitForWatchSpec<YourType> = {
    wait: yourWaitFunction,
    match: yourMatchFunction,
    };

    waitForWatch(ctx, options)
    .then(match => console.log('Watcher matched with:', match))
    .catch(err => console.error('Error in waitForWatch:', err));