Comparing version 0.4.1 to 1.0.0
@@ -96,4 +96,11 @@ 'use strict'; | ||
}).enter(machine2, service, event) | ||
rn.then(data => service.send({ type: 'done', data })) | ||
.catch(error => service.send({ type: 'error', error })); | ||
rn | ||
.then(data => { | ||
if (machine2 === service.machine) | ||
return service.send({ type: 'done', data }); | ||
}) | ||
.catch(error => { | ||
if (machine2 === service.machine) | ||
return service.send({ type: 'error', error }); | ||
}); | ||
return machine2; | ||
@@ -169,2 +176,4 @@ } | ||
let state = newMachine.state.value; | ||
service.machine = newMachine; | ||
service.onChange(service); | ||
return state.enter(newMachine, service, fromEvent); | ||
@@ -190,6 +199,3 @@ } | ||
send(event) { | ||
this.machine = send(this, event); | ||
// TODO detect change | ||
this.onChange(this); | ||
send(this, event); | ||
} | ||
@@ -196,0 +202,0 @@ }; |
@@ -92,4 +92,11 @@ function valueEnumerable(value) { | ||
}).enter(machine2, service, event) | ||
rn.then(data => service.send({ type: 'done', data })) | ||
.catch(error => service.send({ type: 'error', error })); | ||
rn | ||
.then(data => { | ||
if (machine2 === service.machine) | ||
return service.send({ type: 'done', data }); | ||
}) | ||
.catch(error => { | ||
if (machine2 === service.machine) | ||
return service.send({ type: 'error', error }); | ||
}); | ||
return machine2; | ||
@@ -165,2 +172,4 @@ } | ||
let state = newMachine.state.value; | ||
service.machine = newMachine; | ||
service.onChange(service); | ||
return state.enter(newMachine, service, fromEvent); | ||
@@ -186,6 +195,3 @@ } | ||
send(event) { | ||
this.machine = send(this, event); | ||
// TODO detect change | ||
this.onChange(this); | ||
send(this, event); | ||
} | ||
@@ -192,0 +198,0 @@ }; |
{ | ||
"name": "robot3", | ||
"version": "0.4.1", | ||
"version": "1.0.0", | ||
"description": "A functional, immutable Finite State Machine library", | ||
"main": "dist/machine.js", | ||
"types": "./index.d.ts", | ||
"exports": { | ||
".": { | ||
"require": "./dist/machine.js", | ||
"types": "./index.d.ts", | ||
"import": "./machine.js", | ||
"default": "./machine.js" | ||
"default": "./machine.js", | ||
"types": "./index.d.ts" | ||
} | ||
@@ -12,0 +15,0 @@ }, |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
25981
667
0