/    Sign up×
Community /Pin to ProfileBookmark

getting error “machineDefinition is undefined” I already follow steps?

I am using below package for demo application

https://www.npmjs.com/package/@opuscapita/fsm-workflow-core

I follow all steps whatever it is written in doc .But getting error
**machineDefinition is undefined**

here is my code
https://codesandbox.io/s/inspiring-banzai-xumr2?file=/src/index.js

var http = require(“http”);

let { MachineDefinition, Machine } = require(“@opuscapita/fsm-workflow-core”);

var machineDefinition = new MachineDefinition({
schema: {
initialState: “start”,
finalStates: [“finish”],
transitions: [{ from: “start”, event: “run”, to: “finish” }]
}
});

const object = { status: “none” };
const machine = new Machine(machineDefinition);
machine
.start({ object })
.then(({ object }) => {
console.log(machine.currentState({ object }));
// start
return machine.sendEvent({ object, event: “start” });
})
.then(({ object }) => {
console.log(machine.currentState({ object }));
// finish
});

//create a server object:
http
.createServer(function(req, res) {
res.write(“Hello World!”); //write a response to the client
res.end(); //end the response
})
.listen(8080); //the server object listens on port 8080

could you please tell me where I am doing wrong .?

One more thing this package is `Apache-2.0` licence .can I use this package in my real project ?

to post a comment

0Be the first to comment 😎

×

Success!

Help @naveen1989 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...