Comparing version 1.2.0 to 1.2.1
@@ -76,3 +76,3 @@ const Eventm = function() { | ||
? options.disableErrorParameter | ||
: false, | ||
: true, | ||
promise: | ||
@@ -79,0 +79,0 @@ typeof options.promise === "boolean" |
@@ -1,1 +0,1 @@ | ||
const Eventm=function(){const a=function(a,b){const c={dataInCache:null,state:null,stack:[]},d=b.promise&&new Promise((a,c)=>{b.resolve=a,b.reject=c})||void 0,e=a=>(b.promise&&("resolve"===c.state?b.resolve(c.dataInCache):b.reject(c.dataInCache)),"function"==typeof a?b.disableErrorParameter&&"resolve"===c.state?a(c.dataInCache):a("reject"===c.state&&c.dataInCache,"resolve"===c.state&&c.dataInCache):void 0),f=(b,d)=>f=>{if(null!==c.state&&!d)throw a+"_statement_is_already_set_to_"+c.state;c.state=b,c.dataInCache=f,c.stack.map(a=>e(a))};return this.getPromise=()=>d,this.resolveForced=f("resolve",!0),this.resolve=f("resolve"),this.reject=f("reject"),this.push=a=>{const d=c.stack.push(a)-1;return null!==c.state&&b.keepSession?e(a):d},this},b={};return this.getEvent=a=>b[a],this.create=(c,d,e)=>(e=e||{},e={keepSession:"boolean"!=typeof e.keepSession||e.keepSession,disableErrorParameter:"boolean"==typeof e.disableErrorParameter&&e.disableErrorParameter,promise:"boolean"==typeof e.promise&&e.promise},b[c]=b[c]||new a(c,e),b[c].push(d),b[c].getPromise()),this};module&&module.exports&&(module.exports=Eventm); | ||
const Eventm=function(){const a=function(a,b){const c={dataInCache:null,state:null,stack:[]},d=b.promise&&new Promise((a,c)=>{b.resolve=a,b.reject=c})||void 0,e=a=>(b.promise&&("resolve"===c.state?b.resolve(c.dataInCache):b.reject(c.dataInCache)),"function"==typeof a?b.disableErrorParameter&&"resolve"===c.state?a(c.dataInCache):a("reject"===c.state&&c.dataInCache,"resolve"===c.state&&c.dataInCache):void 0),f=(b,d)=>f=>{if(null!==c.state&&!d)throw a+"_statement_is_already_set_to_"+c.state;c.state=b,c.dataInCache=f,c.stack.map(a=>e(a))};return this.getPromise=()=>d,this.resolveForced=f("resolve",!0),this.resolve=f("resolve"),this.reject=f("reject"),this.push=a=>{const d=c.stack.push(a)-1;return null!==c.state&&b.keepSession?e(a):d},this},b={};return this.getEvent=a=>b[a],this.create=(c,d,e)=>(e=e||{},e={keepSession:"boolean"!=typeof e.keepSession||e.keepSession,disableErrorParameter:"boolean"!=typeof e.disableErrorParameter||e.disableErrorParameter,promise:"boolean"==typeof e.promise&&e.promise},b[c]=b[c]||new a(c,e),b[c].push(d),b[c].getPromise()),this};module&&module.exports&&(module.exports=Eventm); |
@@ -6,6 +6,6 @@ // -------------- BEHIND | ||
{ | ||
this.tryEventInSingleParam = (cb) => mevent.create('tryEventInSingleParam', cb, { disableErrorParameter: true }); | ||
this.tryEventInSingleParam = (cb) => mevent.create('tryEventInSingleParam', cb); | ||
setTimeout(() => mevent.getEvent('tryEventInSingleParam').resolve('tryEventInSingleParam function executed'), 1000); | ||
this.tryEventMultiParams = (cb) => mevent.create('tryEventMultiParams', cb); | ||
this.tryEventMultiParams = (cb) => mevent.create('tryEventMultiParams', cb, { disableErrorParameter: false }); | ||
setTimeout(() => mevent.getEvent('tryEventMultiParams').resolve('tryEventMultiParams function executed'), 2000); | ||
@@ -12,0 +12,0 @@ |
{ | ||
"name": "eventm", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Eventm help you to manage all evenements in your code. The library store the state and the callback stack for you.", | ||
@@ -5,0 +5,0 @@ "main": "eventm.min.js", |
@@ -19,6 +19,6 @@ # Event Manager | ||
{ | ||
this.tryEventInSingleParam = (cb) => mevent.create('tryEventInSingleParam', cb, { disableErrorParameter: true }); | ||
this.tryEventInSingleParam = (cb) => mevent.create('tryEventInSingleParam', cb); | ||
setTimeout(() => mevent.getEvent('tryEventInSingleParam').resolve('tryEventInSingleParam function executed'), 1000); | ||
this.tryEventMultiParams = (cb) => mevent.create('tryEventMultiParams', cb); | ||
this.tryEventMultiParams = (cb) => mevent.create('tryEventMultiParams', cb, { disableErrorParameter: false }); | ||
setTimeout(() => mevent.getEvent('tryEventMultiParams').resolve('tryEventMultiParams function executed'), 2000); | ||
@@ -85,4 +85,4 @@ | ||
| --------------------- | ------- | ----------- | ||
| disableErrorParameter | false | true = When the callback is executing, only `data` parameter is accessible | ||
| disableErrorParameter | true | true = When the callback is executing, only `data` parameter is accessible | ||
| keepSession | true | true = If the callback is alreayd executed, `keepSession` keep the session open for the futur callback | ||
| promise | false | true = Enable Promise and `create` method return a Promise |
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