import { EventDispatcher } from './EventDispatcher'; import { Constructor } from '../utils'; import { Object3D } from 'three'; import { ConstructorInstanceMap } from '../utils/ConstructorInstanceMap'; export interface AbstractModuleStatus { enabled: boolean; } export declare abstract class AbstractModule extends EventDispatcher { __requiredModules: Array>; /** * Map of instances, that are owned by this module */ protected instances: Map; /** * Function to get instance from current module * @param name Name of instance. Check the documentation of module */ getInstance(name: string): any; /** * Function, that is called before actual initialization. Use it to check hardware, check compatibility, etc. * @returns Promise of Module status. For example if this module supported by user's hardware? */ abstract preInit(): Promise; /** * Initialization of module. All instances have to be created in this function. * @param data Data from g.frame core. * @todo Describe data argument in initialization function * @returns Promise of instances array */ abstract onInit(data: any): Promise>; /** * Function that is called after initialization. Use it only for internal stuff. */ abstract afterInit(agents?: ConstructorInstanceMap, modules?: ConstructorInstanceMap): void; getModuleContainer(): Object3D | void; /** * Update function for module. Use only this function for all updates. * @param params Current frame information * @param params.currentTime Time in milliseconds from starts * @param params.frame Current XRFrame for WebXR * @todo When typescript will have WebXR API declarations -- put frame: XRFrame */ abstract onUpdate(params: { currentTime: number; frame: any; }): void; /** * Function that is called before actual destruction. All resources should be disposed and removed. */ abstract onDestroy(): void; /** * Function that is called when application is paused (For example tab is changed) */ onPause(): void; /** * Function that is called when application is resumed */ onResume(): void; }