UNPKG

igniteui-webcomponents

Version:

Ignite UI for Web Components is a complete library of UI components, giving you the ability to build modern web applications using encapsulation and the concept of reusable components in a dependency-free approach.

25 lines 691 B
class CommandController { constructor(host) { this._commandMap = new Map(); this._host = host; host.addController(this); } set(command, callback) { this._commandMap.set(command, callback); return this; } hostConnected() { this._host.addEventListener('command', this); } hostDisconnected() { this._host.removeEventListener('command', this); } handleEvent(event) { const commandEvent = event; this._commandMap.get(commandEvent.command)?.call(this._host); } } export function addCommandController(host) { return new CommandController(host); } //# sourceMappingURL=command.js.map