406
}, delay);
407
} else {
408
>
// Use a special marker to indicate microtask is pending
event.ts
409
>
handle = 0 as unknown as Timeout;
410
>
queueMicrotask(() => {
411
>
// Fire on trailing edge if there were calls during throttle period
412
>
if (trailing && numThrottledCalls > 0) {
413
>
emitter.fire(output!);
414
>
}
415
>
output = undefined;
416
>
handle = undefined;
417
>
numThrottledCalls = 0;
418
>
});
419
>
}
420
}
421
// If already throttling, just accumulate the value for trailing edge