UNPKG

@needle-tools/engine

Version:

Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.

55 lines (54 loc) 2.27 kB
import { InstantiateContext } from "../engine/engine_gameobject.js"; import type { IEventList } from "../engine/engine_types.js"; export declare class CallInfo { /** * When the CallInfo is enabled it will be invoked when the EventList is invoked */ enabled: boolean; /** * The target object to invoke the method on OR the function to invoke */ target: Object | Function; methodName: string | null; /** * The arguments to invoke this method with */ arguments?: Array<any>; get canClone(): boolean; constructor(target: Function); constructor(target: Object, methodName: string | null, args?: Array<any>, enabled?: boolean); invoke(...args: any): void; } export declare class EventListEvent<TArgs extends any> extends Event { args?: TArgs; } /** * The EventList is a class that can be used to create a list of event listeners that can be invoked */ export declare class EventList<TArgs extends any = any> implements IEventList { /** checked during instantiate to create a new instance */ readonly isEventList = true; /** * @internal Used by the Needle Engine instantiate call to remap the event listeners to the new instance */ __internalOnInstantiate(ctx: InstantiateContext): EventList<any>; private target?; private key?; /** set an event target to try invoke the EventTarget dispatchEvent when this EventList is invoked */ setEventTarget(key: string, target: object): void; /** How many callback methods are subscribed to this event */ get listenerCount(): number; /** If the event is currently being invoked */ get isInvoking(): boolean; private _isInvoking; private readonly methods; private readonly _methodsCopy; static from(...evts: Array<Function>): EventList<any>; constructor(evts?: Array<CallInfo | Function> | Function); /** Invoke all the methods that are subscribed to this event */ invoke(...args: Array<TArgs>): boolean; /** Add a new event listener to this event */ addEventListener(cb: (args: TArgs) => void): Function; removeEventListener(cb: Function | null | undefined): void; removeAllEventListeners(): void; }