UNPKG

@tsparticles/engine

Version:

Easily create highly customizable particle, confetti and fireworks animations and use them as animated backgrounds for your website. Ready to use components available also for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Riot.js, Inferno.

31 lines (30 loc) 984 B
import { ClickEvent } from "./ClickEvent.js"; import { DivEvent } from "./DivEvent.js"; import { HoverEvent } from "./HoverEvent.js"; import { ResizeEvent } from "./ResizeEvent.js"; import { executeOnSingleOrMultiple } from "../../../../Utils/Utils.js"; import { isNull } from "../../../../Utils/TypeUtils.js"; export class Events { constructor() { this.onClick = new ClickEvent(); this.onDiv = new DivEvent(); this.onHover = new HoverEvent(); this.resize = new ResizeEvent(); } load(data) { if (isNull(data)) { return; } this.onClick.load(data.onClick); const onDiv = data.onDiv; if (onDiv !== undefined) { this.onDiv = executeOnSingleOrMultiple(onDiv, t => { const tmp = new DivEvent(); tmp.load(t); return tmp; }); } this.onHover.load(data.onHover); this.resize.load(data.resize); } }