mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00

* feat: support requestAnimationFrame * add native helpers to measure time * test(animation-frame): add tests * chore: refactor animation-frame to its own module * chore: fix tslint
25 lines
631 B
TypeScript
25 lines
631 B
TypeScript
/**
|
|
* Allows you to create, cancel and react to listeners to animation frames.
|
|
* @module "animation-frame"
|
|
*/ /** */
|
|
|
|
/**
|
|
* Callback called on frame rendered
|
|
* @argument time Time of the current frame in milliseconds
|
|
*/
|
|
export interface FrameRequestCallback {
|
|
(time: number): void;
|
|
}
|
|
|
|
/**
|
|
* Requests an animation frame and returns the timer ID
|
|
* @param cb Callback to be called on frame
|
|
*/
|
|
export function requestAnimationFrame(cb: FrameRequestCallback): number
|
|
|
|
/**
|
|
* Cancels a previously scheduled animation frame request
|
|
* @param id timer ID to cancel
|
|
*/
|
|
export function cancelAnimationFrame(id: number): void;
|