UNPKG

@yuebai008/cli

Version:

Command line interface for rapid qg-minigame development

1 lines 980 B
import*as Common from"../../core/common/common.js";let instance=null;export class RecorderPluginManager extends Common.ObjectWrapper.ObjectWrapper{#e=new Set;#i=new Map;static instance(){return instance||(instance=new RecorderPluginManager),instance}addPlugin(e){this.#e.add(e),this.dispatchEventToListeners(Events.PluginAdded,e)}removePlugin(e){this.#e.delete(e),this.dispatchEventToListeners(Events.PluginRemoved,e)}plugins(){return Array.from(this.#e.values())}registerView(e){this.#i.set(e.id,e),this.dispatchEventToListeners(Events.ViewRegistered,e)}views(){return Array.from(this.#i.values())}getViewDescriptor(e){return this.#i.get(e)}showView(e){const i=this.#i.get(e);if(!i)throw new Error(`View with id ${e} is not found.`);this.dispatchEventToListeners(Events.ShowViewRequested,i)}}export var Events;!function(e){e.PluginAdded="pluginAdded",e.PluginRemoved="pluginRemoved",e.ViewRegistered="viewRegistered",e.ShowViewRequested="showViewRequested"}(Events||(Events={}));