hadron-app-registry
Advanced tools
Comparing version 7.0.0 to 7.0.1
@@ -24,11 +24,9 @@ 'use strict'; | ||
*/ | ||
class AppRegistry extends EventEmitter { | ||
class AppRegistry { | ||
/** | ||
* Instantiate the registry. | ||
* | ||
* @todo: Package manager activates at end. | ||
*/ | ||
constructor() { | ||
super(); | ||
this._emitter = new EventEmitter(); | ||
this.actions = {}; | ||
@@ -278,2 +276,130 @@ this.components = {}; | ||
/** | ||
* Adds a listener for the event name to the underlying event emitter. | ||
* | ||
* @param {String} eventName - The event name. | ||
* @param {Function} listener - The listener. | ||
* | ||
* @returns {AppRegistry} The chainable app registry. | ||
*/ | ||
addListener(eventName, listener) { | ||
return this.on(eventName, listener); | ||
} | ||
/** | ||
* Emits an event for the name with the provided arguments. | ||
* | ||
* @param {String} eventName - The event name. | ||
* @param {...Object} args - The arguments. | ||
* | ||
* @returns {Boolean} If the event had listeners. | ||
*/ | ||
emit(eventName, ...args) { | ||
return this._emitter.emit(eventName, ...args); | ||
} | ||
/** | ||
* Return all the event names. | ||
* | ||
* @returns {Array} The event names. | ||
*/ | ||
eventNames() { | ||
return this._emitter.eventNames(); | ||
} | ||
/** | ||
* Get the number of listeners for the registry to warn on. | ||
* | ||
* @returns {Number} The number of max listeners. | ||
*/ | ||
getMaxListeners() { | ||
return this._emitter.getMaxListeners(); | ||
} | ||
/** | ||
* Gets a count of listeners for the event name. | ||
* | ||
* @param {String} eventName - The event name. | ||
* | ||
* @returns {Number} The listener count. | ||
*/ | ||
listenerCount(eventName) { | ||
return this._emitter.listenerCount(eventName); | ||
} | ||
/** | ||
* Get all the listeners for the event. | ||
* | ||
* @param {String} eventName - The event name. | ||
* | ||
* @returns {Array} The listeners for the event. | ||
*/ | ||
listeners(eventName) { | ||
return this._emitter.listeners(eventName); | ||
} | ||
/** | ||
* Adds a listener for the event name to the underlying event emitter. | ||
* | ||
* @param {String} eventName - The event name. | ||
* @param {Function} listener - The listener. | ||
* | ||
* @returns {AppRegistry} The chainable app registry. | ||
*/ | ||
on(eventName, listener) { | ||
this._emitter.on(eventName, listener); | ||
return this; | ||
} | ||
/** | ||
* Adds a listener for the event name to the underlying event emitter | ||
* to handle an event only once. | ||
* | ||
* @param {String} eventName - The event name. | ||
* @param {Function} listener - The listener. | ||
* | ||
* @returns {AppRegistry} The chainable app registry. | ||
*/ | ||
once(eventName, listener) { | ||
this._emitter.once(eventName, listener); | ||
return this; | ||
} | ||
/** | ||
* Removes a listener for the event. | ||
* | ||
* @param {String} eventName - The event name. | ||
* @param {Function} listener - The listener. | ||
* | ||
* @returns {AppRegistry} The chainable app registry. | ||
*/ | ||
removeListener(eventName, listener) { | ||
this._emitter.removeListener(eventName, listener); | ||
return this; | ||
} | ||
/** | ||
* Removes all the listeners for the event name. | ||
* | ||
* @param {String} eventName - The event name. | ||
* | ||
* @returns {AppRegistry} The chainable app registry. | ||
*/ | ||
removeAllListeners(eventName) { | ||
this._emitter.removeAllListeners(eventName); | ||
return this; | ||
} | ||
/** | ||
* Sets the max listeners to warn on for the emitter. | ||
* | ||
* @param {Number} n - The max listeners. | ||
* | ||
* @returns {AppRegistry} The app registry. | ||
*/ | ||
setMaxListeners(n) { | ||
this._emitter.setMaxListeners(n); | ||
return this; | ||
} | ||
_callOnStores(fn) { | ||
@@ -280,0 +406,0 @@ for (let key in this.stores) { |
@@ -7,3 +7,3 @@ { | ||
"homepage": "https://github.com/mongodb-js/hadron-app-registry", | ||
"version": "7.0.0", | ||
"version": "7.0.1", | ||
"repository": { | ||
@@ -10,0 +10,0 @@ "type": "git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26898
575