UNPKG

@ktt45678/vidstack

Version:

UI component library for building high-quality, accessible video and audio experiences on the web.

25 lines (22 loc) 509 B
import { isUndefined, isNumber } from './vidstack-fG_Sx3Q9.js'; class RAFLoop { constructor(_callback) { this._callback = _callback; } _start() { if (!isUndefined(this._id)) return; this._loop(); } _stop() { if (isNumber(this._id)) window.cancelAnimationFrame(this._id); this._id = void 0; } _loop() { this._id = window.requestAnimationFrame(() => { if (isUndefined(this._id)) return; this._callback(); this._loop(); }); } } export { RAFLoop };