Comparing version 2.0.0 to 2.1.0
@@ -517,2 +517,4 @@ 'use strict'; | ||
if (this._dispatchFun) this._dispatchFun(action); | ||
/* don't throw an error because somethings might spew out actions | ||
@@ -774,2 +776,5 @@ * that don't necessarily mean an console.error | ||
//the event listener will get access to the manager itself | ||
if (this._emitFun) this._emitFun(eventType, arg); | ||
return this._emitter.emit(eventType, arg, this); | ||
@@ -927,2 +932,50 @@ } | ||
} | ||
/** | ||
* @description - This allows for the user to add a function | ||
* that will be called every time the dispatch function on | ||
* the manager function is invoked | ||
* @param {Function} fun - the function that will be called on | ||
* every dispatch | ||
*/ | ||
}, { | ||
key: 'addDispatchSideEffect', | ||
value: function addDispatchSideEffect(fun) { | ||
this._dispatchFun = fun; | ||
} | ||
/** | ||
* @description - removes the side effect functions from | ||
* {@link dispatch} | ||
*/ | ||
}, { | ||
key: 'removeDispatchSideEffect', | ||
value: function removeDispatchSideEffect() { | ||
if (this._dispatchFun) delete this._dispatchFun; | ||
} | ||
/** | ||
* @description - Like {@link addDispatchSideEffect} this adds | ||
* a side effect for {@link emit} | ||
* @param {Function} function - function that will be called for | ||
* every emit | ||
*/ | ||
}, { | ||
key: 'addEmitSideEffect', | ||
value: function addEmitSideEffect(fun) { | ||
this._emitFun = fun; | ||
} | ||
/** | ||
* @description - Removes the side effect from {@link addEmitSideEffect} | ||
*/ | ||
}, { | ||
key: 'removeEmitSideEffect', | ||
value: function removeEmitSideEffect() { | ||
if (this._emitFun) delete this._emitFun; | ||
} | ||
}]); | ||
@@ -929,0 +982,0 @@ |
{ | ||
"name": "sam-ecs", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "A specialized entity component system", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
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
43599
1097