import { DcController } from "../DcController.js"; import { KeyEvent } from "../events/KeyEvent.js"; import { DcEvent } from "../events/DcEvent.js"; import { CameraPositionEvent } from "../events/CameraPositionEvent.js"; import { EnvironmentRotationEvent } from "../events/EnvironmentRotationEvent.js"; import { GeometryTransformEvent } from "../events/GeometryTransformEvent.js"; import { EngineErrorEvent } from "../events/EngineErrorEvent.js"; /** * Mapping of event names to their corresponding event interfaces. */ export type DcEventMap = { "key-down-event": KeyEvent; "key-up-event": KeyEvent; load: DcEvent; unload: DcEvent; ready: DcEvent; error: EngineErrorEvent; "camera-position-change": CameraPositionEvent; "environment-rotation-change": EnvironmentRotationEvent; "geometry-transform-change": GeometryTransformEvent; }; /** * Registers a key down event listener. * * Whenever a key is pressed while the iframe is focused, this event is * dispatched. This can be useful since the embedder of the iframe does not * receive key down events that happen inside the iframe. * * @param dcController The DcController object obtained from the init function. * @param eventName "key-down-event" * @param callback The callback function that is called whenever a key is * pressed. * @returns A function that can be used to unregister the listener. */ export declare function on(dcController: DcController, eventName: "key-down-event", callback: (event: KeyEvent) => void): () => void; /** * Registers a key up event listener. * * Whenever a key is released while the iframe is focused, this event is * dispatched. This can be useful since the embedder of the iframe does not * receive key up events that happen inside the iframe. * * @param dcController The DcController object obtained from the init function. * @param eventName "key-up-event" * @param callback The callback function that is called whenever a key is * released. * @returns A function that can be used to unregister the listener. */ export declare function on(dcController: DcController, eventName: "key-up-event", callback: (event: KeyEvent) => void): () => void; /** * Registers a load event listener. * * This event is dispatched when the engine is loaded. * * @param dcController The DcController object obtained from the init function. * @param eventName "load" * @param callback The callback function that is called whenever the engine is * loaded. * @returns A function that can be used to unregister the listener. */ export declare function on(dcController: DcController, eventName: "load", callback: (event: DcEvent) => void): () => void; /** * Registers a unload event listener. * * This event is dispatched when the engine is unloaded. * * @param dcController The DcController object obtained from the init function. * @param eventName "unload" * @param callback The callback function that is called whenever the engine is * unloaded. * @returns A function that can be used to unregister the listener. */ export declare function on(dcController: DcController, eventName: "unload", callback: (event: DcEvent) => void): () => void; /** * Registers a ready event listener. * * This event is dispatched when the engine is ready. * It can be used to display a waiting indicator while the engine is loading. * * @param dcController The DcController object obtained from the init function. * @param eventName "ready" * @param callback The callback function that is called whenever the engine is * ready. * @returns A function that can be used to unregister the listener. */ export declare function on(dcController: DcController, eventName: "ready", callback: (event: DcEvent) => void): () => void; /** * Registers an error event listener. * * This event is dispatched once when the loaded engine failed: it did not * start or become ready in time (see the timeouts in `DCOptions`), or it * reported a fatal error. Embedders should replace their loading indicator * with an error state; `unload` followed by `load` starts a new attempt. * * If the engine already failed when the listener is registered, the callback * is called right away (asynchronously). * * @param dcController The DcController object obtained from the init function. * @param eventName "error" * @param callback The callback function that is called when the engine fails. * @returns A function that can be used to unregister the listener. */ export declare function on(dcController: DcController, eventName: "error", callback: (event: EngineErrorEvent) => void): () => void; /** * Registers a camera position change event listener. * * This event is dispatched when the camera position changes. * * @param dcController The DcController object obtained from the init function. * @param eventName "camera-position-change" * @param callback The callback function that is called whenever the camera position is change * @returns A function that can be used to unregister the listener. */ export declare function on(dcController: DcController, eventName: "camera-position-change", callback: (event: CameraPositionEvent) => void): () => void; /** * Registers a environment rotation change event listener. * * This event is dispatched when the rotation of the scene environment is changed * * @param dcController The DcController object obtained from the init function. * @param eventName "environment-rotation-change" * @param callback The callback function that is called whenever the environment is rotated * @returns A function that can be used to unregister the listener. */ export declare function on(dcController: DcController, eventName: "environment-rotation-change", callback: (event: EnvironmentRotationEvent) => void): () => void; /** * Registers a geometry transform change event listener. * * This event is dispatched when the position or rotation of the geometry is changed * * @param dcController The DcController object obtained from the init function. * @param eventName "geometry-transform-change" * @param callback The callback function that is called whenever the geometry transform is changed * @returns A function that can be used to unregister the listener. */ export declare function on(dcController: DcController, eventName: "geometry-transform-change", callback: (event: GeometryTransformEvent) => void): () => void;