"use strict";

export class CommandsObserver {
  listeners = {};
  constructor(uniqueIdProvider) {
    this.uniqueIdProvider = uniqueIdProvider;
  }
  register(listener) {
    const id = this.uniqueIdProvider.generate();
    this.listeners[id] = listener;
    return {
      remove: () => delete this.listeners[id]
    };
  }
  notify(commandName, params) {
    Object.values(this.listeners).forEach(listener => listener(commandName, params));
  }
}
//# sourceMappingURL=CommandsObserver.js.map