Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

Commit

Permalink
[resolves #34] Allow param to be passed to emitChange events; Default…
Browse files Browse the repository at this point in the history
… to the store instance instead of the store class
  • Loading branch information
mridgway committed Nov 15, 2014
1 parent 2423478 commit 1fac904
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions utils/BaseStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ util.inherits(BaseStore, EventEmitter);
* @method addChangeListener
* @param {Function} callback
*/
BaseStore.prototype.addChangeListener = function(callback) {
BaseStore.prototype.addChangeListener = function addChangeListener(callback) {
this.on(CHANGE_EVENT, callback);
};

Expand All @@ -37,16 +37,17 @@ BaseStore.prototype.addChangeListener = function(callback) {
* @method removeChangeListener
* @param {Function} callback
*/
BaseStore.prototype.removeChangeListener = function(callback) {
BaseStore.prototype.removeChangeListener = function removeChangeListener(callback) {
this.removeListener(CHANGE_EVENT, callback);
};

/**
* Emit a change event
* @method emitChange
* @param {*} param=this
*/
BaseStore.prototype.emitChange = function() {
this.emit(CHANGE_EVENT, this.constructor);
BaseStore.prototype.emitChange = function emitChange(param) {
this.emit(CHANGE_EVENT, param || this);
};

module.exports = BaseStore;

0 comments on commit 1fac904

Please sign in to comment.