import Server from "./server/Server"; /** * 事件机制基类。 * @class */ export default class Controller { bimViewer: any; server: Server; viewer: any; protected _children: any; protected _subIdMap: any; protected _subIdEvents: any; protected _eventSubs: any; protected _events: any; protected _eventCallDepth: number; protected _enabled: any; protected _active: any; destroyed: boolean; /** * 创建一个Controller。 * @param {any} parent - * @param {any} cfg - * @param {Server} server - * @param {any} viewer - */ constructor(parent: any, cfg?: any, server?: any, viewer?: any); /** * Fires an event on this Controller. * @param {string} event - 事件类型名称。 * @param {object} value - 事件参数。 * @param {boolean} [forget=false] - When true, does not retain for subsequent subscribers. */ protected fire(event: string, value: any, forget?: boolean): void; /** * Subscribes to an event on this Controller. * * The callback is be called with this component as scope. * * @param {string} event The event * @param {Function} callback Called fired on the event * @param {object} [scope=this] Scope for the callback * @return {string} Handle to the subscription, * which may be used to unsubscribe with {@link #off}. */ on(event: string, callback: Function, scope?: object): string; /** * Cancels an event subscription that was previously made with * {@link Controller#on} or {@link Controller#once}. * * @param {string} subId Subscription ID */ off(subId: string): void; /** * Subscribes to the next occurrence of the given event, * then un-subscribes as soon as the event is handled. * * This is equivalent to calling {@link Controller#on}, and then * calling {@link Controller#off} inside the callback function. * * @param {string} event Data event to listen to * @param {Function} callback Called when fresh data is available at the event * @param {object} [scope=this] Scope for the callback */ once(event: string, callback: Function, scope?: object): void; /** * Logs a console debugging message for this Controller. * * The console message will have this format: * *````[LOG] [ : ````* * * @protected * * @param {string} message The message to log */ log(message: string): void; /** * Logs a warning for this Controller to the JavaScript console. * * The console message will have this format: * *````[WARN] [ =: ````* * * @protected * * @param {string} message The message to log */ static warn(message: string): void; /** * Logs an error for this Controller to the JavaScript console. * * The console message will have this format: * *````[ERROR] [ =: ````* * * @protected * * @param {string} message The message to log */ error(message: string): void; protected _mutexActivation(controllers: Array): void; /** * Enables or disables this Controller. * * Fires an "enabled" event on update. * * @protected * @param {boolean} enabled Whether or not to enable. */ setEnabled(enabled: boolean): void; /** * Gets whether or not this Controller is enabled. * * @protected * * @returns {boolean} */ getEnabled(): boolean; /** * Activates or deactivates this Controller. * * Fires an "active" event on update. * * @protected * * @param {boolean} active Whether or not to activate. */ setActive(active: boolean): void; /** * Gets whether or not this Controller is active. * * @protected * * @returns {boolean} */ getActive(): boolean; /** * Destroys this Controller. * * @protected * */ destroy(): void; }