Home > @cascadiacollections/fluentui-compat > Async > requestAnimationFrame
Async.requestAnimationFrame() method
Optimized requestAnimationFrame implementation with intelligent fallback handling.
Provides smooth animation frame scheduling with automatic cleanup and cross-browser compatibility. Falls back to setTimeout with 60fps timing when RAF is unavailable.
Signature:
requestAnimationFrame(callback: () => void, targetElement?: Element | null): number;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
callback |
() => void |
Function to execute on the next animation frame |
|
targetElement |
Element | null |
(Optional) Optional element to determine window context |
Returns:
number
Animation frame ID for cancellation