Comparing version 2.0.4 to 2.0.5
import EventEmitter from 'eventemitter3'; | ||
const instance = Symbol('instance'); | ||
// ä¸é´čżć¸Ąçść | ||
@@ -124,2 +125,7 @@ export class MiddleState { | ||
this.name = this.name || this.constructor.name; | ||
const names = Object.getPrototypeOf(this)[instance]; | ||
if (!names) | ||
Object.getPrototypeOf(this)[instance] = { name: this.name, count: 0 }; | ||
else | ||
this.name = names.name + "-" + names.count++; | ||
if (hasDevTools) | ||
@@ -126,0 +132,0 @@ window.dispatchEvent(new CustomEvent("createAFSM", { detail: { name: this.name, diagram: this.stateDiagram } })); |
@@ -5,2 +5,3 @@ import EventEmitter from 'eventemitter3'; | ||
} | ||
const instance = Symbol('instance'); | ||
export type State = string | MiddleState; | ||
@@ -103,2 +104,3 @@ // ä¸é´čżć¸Ąçść | ||
static OFF = "off"; | ||
get stateDiagram() { | ||
@@ -112,2 +114,5 @@ return []; | ||
this.name = this.name || this.constructor.name; | ||
const names = Object.getPrototypeOf(this)[instance]; | ||
if (!names) Object.getPrototypeOf(this)[instance] = { name: this.name, count: 0 }; | ||
else this.name = names.name + "-" + names.count++; | ||
if (hasDevTools) window.dispatchEvent(new CustomEvent("createAFSM", { detail: { name: this.name, diagram: this.stateDiagram } })); | ||
@@ -114,0 +119,0 @@ else if (inWorker) postMessage({ type: 'createAFSM', payload: { name: this.name, diagram: this.stateDiagram } }); |
{ | ||
"name": "afsm", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "atomic fsm", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
3593175
15546