UNPKG

vevet

Version:

Vevet is a JavaScript library for creative development that simplifies crafting rich interactions like split text animations, carousels, marquees, preloading, and more.

26 lines (20 loc) 561 B
import { Snap } from '../..'; export class SnapLogic { /** Listeners to destruct */ private _destructors: (() => void)[] = []; constructor(private _snap: Snap) { _snap.on('destroy', () => this._destroy(), { protected: true }); } /** Snap component */ protected get snap() { return this._snap; } /** Snap component */ protected addDestructor(callback: () => void) { this._destructors.push(callback); } /** Destroy wheel listeners */ private _destroy() { this._destructors.forEach((destructor) => destructor()); } }