UNPKG

vim-webgl-component

Version:

A demonstration app built on top of the vim-webgl-viewer

40 lines (39 loc) 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NonUniformSimpleEventList = void 0; const SimpleEventDispatcher_1 = require("./SimpleEventDispatcher"); /** * Similar to EventList, but instead of TArgs, a map of event names ang argument types is provided with TArgsMap. */ class NonUniformSimpleEventList { constructor() { this._events = {}; } /** * Gets the dispatcher associated with the name. * @param name The name of the event. */ get(name) { if (this._events[name]) { // @TODO avoid typecasting. Not sure why TS thinks this._events[name] could still be undefined. return this._events[name]; } const event = this.createDispatcher(); this._events[name] = event; return event; } /** * Removes the dispatcher associated with the name. * @param name The name of the event. */ remove(name) { delete this._events[name]; } /** * Creates a new dispatcher instance. */ createDispatcher() { return new SimpleEventDispatcher_1.SimpleEventDispatcher(); } } exports.NonUniformSimpleEventList = NonUniformSimpleEventList;