Function withTimeDifference

  • Custom RxJS operator that accumulates notifications with their elapsed time relative to a provided start time.

    Each emitted notification string is converted into a NotificationEntry object, and the operator maintains an array of all previous entries.

    Returns

    An OperatorFunction that transforms an Observable of strings into an Observable of NotificationEntry[].

    Example

    const startTime = performance.now();
    notifications$.pipe(withTimeDifference(startTime)).subscribe(entries => {
    console.log(entries); // Array of NotificationEntry objects with elapsed time
    });

    Parameters

    • startTime: number

      The timestamp (in milliseconds) to use as the reference point for calculating elapsed time. Typically obtained via performance.now().

    Returns OperatorFunction<string, NotificationEntry[]>

Generated using TypeDoc