This repository has been archived on 2026-06-18. You can view files and clone it, but cannot push or open issues or pull requests.
Files
skyai_dev 5346d6d0c9 Add comprehensive library expansion with new components and demos
- Add new libraries: ui-accessibility, ui-animations, ui-backgrounds, ui-code-display, ui-data-utils, ui-font-manager, hcl-studio
- Add extensive layout components: gallery-grid, infinite-scroll-container, kanban-board, masonry, split-view, sticky-layout
- Add comprehensive demo components for all new features
- Update project configuration and dependencies
- Expand component exports and routing structure
- Add UI landing pages planning document

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-05 05:37:37 +10:00

45 lines
1.6 KiB
TypeScript

import { Subscription } from '../Subscription';
interface AnimationFrameProvider {
schedule(callback: FrameRequestCallback): Subscription;
requestAnimationFrame: typeof requestAnimationFrame;
cancelAnimationFrame: typeof cancelAnimationFrame;
delegate:
| {
requestAnimationFrame: typeof requestAnimationFrame;
cancelAnimationFrame: typeof cancelAnimationFrame;
}
| undefined;
}
export const animationFrameProvider: AnimationFrameProvider = {
// When accessing the delegate, use the variable rather than `this` so that
// the functions can be called without being bound to the provider.
schedule(callback) {
let request = requestAnimationFrame;
let cancel: typeof cancelAnimationFrame | undefined = cancelAnimationFrame;
const { delegate } = animationFrameProvider;
if (delegate) {
request = delegate.requestAnimationFrame;
cancel = delegate.cancelAnimationFrame;
}
const handle = request((timestamp) => {
// Clear the cancel function. The request has been fulfilled, so
// attempting to cancel the request upon unsubscription would be
// pointless.
cancel = undefined;
callback(timestamp);
});
return new Subscription(() => cancel?.(handle));
},
requestAnimationFrame(...args) {
const { delegate } = animationFrameProvider;
return (delegate?.requestAnimationFrame || requestAnimationFrame)(...args);
},
cancelAnimationFrame(...args) {
const { delegate } = animationFrameProvider;
return (delegate?.cancelAnimationFrame || cancelAnimationFrame)(...args);
},
delegate: undefined,
};