import { __read, __spreadArray } from "tslib"; import { Subscription } from '../Subscription'; export var animationFrameProvider = { schedule: function (callback) { var request = requestAnimationFrame; var cancel = cancelAnimationFrame; var delegate = animationFrameProvider.delegate; if (delegate) { request = delegate.requestAnimationFrame; cancel = delegate.cancelAnimationFrame; } var handle = request(function (timestamp) { cancel = undefined; callback(timestamp); }); return new Subscription(function () { return cancel === null || cancel === void 0 ? void 0 : cancel(handle); }); }, requestAnimationFrame: function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var delegate = animationFrameProvider.delegate; return ((delegate === null || delegate === void 0 ? void 0 : delegate.requestAnimationFrame) || requestAnimationFrame).apply(void 0, __spreadArray([], __read(args))); }, cancelAnimationFrame: function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var delegate = animationFrameProvider.delegate; return ((delegate === null || delegate === void 0 ? void 0 : delegate.cancelAnimationFrame) || cancelAnimationFrame).apply(void 0, __spreadArray([], __read(args))); }, delegate: undefined, }; //# sourceMappingURL=animationFrameProvider.js.map