@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.
33 lines (32 loc) • 1.38 kB
TypeScript
import { type Context, FrameEvent } from "./engine_context.js";
import { ContextEvent } from "./engine_context_registry.js";
export declare type Event = ContextEvent | FrameEvent;
declare type LifecycleHookContext = {
context: Context;
};
/**
* A function that can be called during the Needle Engine frame event at a specific point
* @link https://engine.needle.tools/docs/scripting.html#special-lifecycle-hooks
*/
export declare type LifecycleMethod = (this: LifecycleHookContext, ctx: Context) => void;
/**
* Options for `onStart(()=>{})` etc event hooks
* @link https://engine.needle.tools/docs/scripting.html#special-lifecycle-hooks
*/
export declare type LifecycleMethodOptions = {
/**
* If true, the callback will only be called once
*/
once?: boolean;
};
/** register a function to be called during the Needle Engine frame event at a specific point
* @param cb the function to call
* @param evt the event to call the function at
*/
export declare function registerFrameEventCallback(cb: LifecycleMethod, evt: Event, opts?: LifecycleMethodOptions): void;
/**
* unregister a function to be called during the Needle Engine frame event at a specific point
*/
export declare function unregisterFrameEventCallback(cb: LifecycleMethod, evt: Event): void;
export declare function invokeLifecycleFunctions(ctx: Context, evt: Event): void;
export {};