UNPKG

3.26 kBTypeScriptView Raw
1import type { ShapeDrawerAfterEffectFunction, ShapeDrawerDestroyFunction, ShapeDrawerDrawFunction, ShapeDrawerInitFunction } from "./Types/ShapeDrawerFunctions";
2import type { Container } from "./Core/Container";
3import type { CustomEventArgs } from "./Types/CustomEventArgs";
4import type { CustomEventListener } from "./Types/CustomEventListener";
5import type { IInteractor } from "./Core/Interfaces/IInteractor";
6import type { IMovePathGenerator } from "./Core/Interfaces/IMovePathGenerator";
7import type { IOptions } from "./Options/Interfaces/IOptions";
8import type { IParticleMover } from "./Core/Interfaces/IParticlesMover";
9import type { IParticleUpdater } from "./Core/Interfaces/IParticleUpdater";
10import type { IPlugin } from "./Core/Interfaces/IPlugin";
11import type { IShapeDrawer } from "./Core/Interfaces/IShapeDrawer";
12import type { Particle } from "./Core/Particle";
13import { Plugins } from "./Core/Utils/Plugins";
14import type { RecursivePartial } from "./Types/RecursivePartial";
15import type { SingleOrMultiple } from "./Types/SingleOrMultiple";
16export declare class Engine {
17 readonly plugins: Plugins;
18 private readonly _domArray;
19 private readonly _eventDispatcher;
20 private _initialized;
21 private readonly _loader;
22 constructor();
23 addEventListener(type: string, listener: CustomEventListener): void;
24 addInteractor(name: string, interactorInitializer: (container: Container) => IInteractor): Promise<void>;
25 addMover(name: string, moverInitializer: (container: Container) => IParticleMover): Promise<void>;
26 addParticleUpdater(name: string, updaterInitializer: (container: Container) => IParticleUpdater): Promise<void>;
27 addPathGenerator(name: string, generator: IMovePathGenerator): Promise<void>;
28 addPlugin(plugin: IPlugin): Promise<void>;
29 addPreset(preset: string, options: RecursivePartial<IOptions>, override?: boolean): Promise<void>;
30 addShape(shape: SingleOrMultiple<string>, drawer: IShapeDrawer | ShapeDrawerDrawFunction, init?: ShapeDrawerInitFunction, afterEffect?: ShapeDrawerAfterEffectFunction, destroy?: ShapeDrawerDestroyFunction): Promise<void>;
31 dispatchEvent(type: string, args: CustomEventArgs): void;
32 dom(): Container[];
33 domItem(index: number): Container | undefined;
34 init(): void;
35 load(tagId: string | SingleOrMultiple<RecursivePartial<IOptions>>, options?: SingleOrMultiple<RecursivePartial<IOptions>>): Promise<Container | undefined>;
36 loadFromArray(tagId: string, options: RecursivePartial<IOptions>[], index?: number): Promise<Container | undefined>;
37 loadJSON(tagId: string | SingleOrMultiple<string>, pathConfigJson?: SingleOrMultiple<string> | number, index?: number): Promise<Container | undefined>;
38 refresh(): Promise<void>;
39 removeEventListener(type: string, listener: CustomEventListener): void;
40 set(id: string | HTMLElement, element: HTMLElement | RecursivePartial<IOptions>, options?: RecursivePartial<IOptions>): Promise<Container | undefined>;
41 setJSON(id: string | HTMLElement, element: HTMLElement | SingleOrMultiple<string>, pathConfigJson?: SingleOrMultiple<string> | number, index?: number): Promise<Container | undefined>;
42 setOnClickHandler(callback: (e: Event, particles?: Particle[]) => void): void;
43}