UNPKG

@ktt45678/vidstack

Version:

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

38 lines (34 loc) 1.08 kB
import { isUndefined, isNumber } from './vidstack-fG_Sx3Q9.js'; const ADD = Symbol("LIST_ADD" ), REMOVE = Symbol("LIST_REMOVE" ), RESET = Symbol("LIST_RESET" ), SELECT = Symbol("LIST_SELECT" ), READONLY = Symbol("LIST_READONLY" ), SET_READONLY = Symbol("LIST_SET_READONLY" ), ON_RESET = Symbol("LIST_ON_RESET" ), ON_REMOVE = Symbol("LIST_ON_REMOVE" ), ON_USER_SELECT = Symbol("LIST_ON_USER_SELECT" ); const ListSymbol = { _add: ADD, _remove: REMOVE, _reset: RESET, _select: SELECT, _readonly: READONLY, _setReadonly: SET_READONLY, _onReset: ON_RESET, _onRemove: ON_REMOVE, _onUserSelect: ON_USER_SELECT }; 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 { ListSymbol, RAFLoop };