Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

statetransition-mixin

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

statetransition-mixin - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

4

package.json
{
"name": "statetransition-mixin",
"description": "mixin to declare state transition methots like start & stop",
"main": "StatesTransitionMixin.js",
"main": "StateTransitionMixin.js",
"scripts": {

@@ -38,3 +38,3 @@ "cover": "node --harmony ./node_modules/istanbul/lib/cli.js cover --hook-run-in-context ./node_modules/mocha/bin/_mocha -- --R spec --U exports tests",

"homepage": "https://github.com/arlac77/statetransition-mixin#readme",
"version": "1.3.0"
"version": "1.3.1"
}

@@ -28,2 +28,4 @@ /* jslint node: true, esnext: true */

const duringTransitions = {};
let target;
Object.keys(a).forEach(initialState => {

@@ -38,2 +40,3 @@ const t = a[initialState];

addState(t.target);
target = t.target;
});

@@ -43,3 +46,4 @@ actions[actionName] = {

initial: initialTransitions,
during: duringTransitions
during: duringTransitions,
target: target
};

@@ -56,3 +60,3 @@ });

const _Base = {
const BaseMethods = {
/**

@@ -108,3 +112,3 @@ * Called when state transition action is not allowed

Object.assign(object, Base);
Object.assign(object, BaseMethods);
Object.defineProperties(object, properties);

@@ -162,6 +166,2 @@ };

console.log(
`KEYS: ${Object.getOwnPropertyNames(module.exports.StateTransitionMixin)} ${module.exports.StateTransitionMixin}`
);
function rejectUnlessResolvedWithin(promise, timeout) {

@@ -229,3 +229,9 @@ if (timeout === 0) return promise;

value: function () {
// normal start
// target state already reached
if (this.state === action.target) {
return Promise.resolve(this);
}
// normal start we are in the initial state of the action
if (action.initial[this.state]) {

@@ -232,0 +238,0 @@ this._transition = action.initial[this.state];

@@ -88,2 +88,9 @@ /* global describe, it, xit */

it('can be started while running', function (done) {
o.start().then(() => {
assert.equal(o.state, 'running');
done();
}, done);
});
it('and stoped', function (done) {

@@ -90,0 +97,0 @@ o.stop().then(() => {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc