showandtell
Version:
A Javascript library providing debugger-like command-line interactivity for program state inspection and modification
23 lines (17 loc) • 499 B
JavaScript
/**
* This simple program shows how you can create a user interaction
* session that supports the commands supplied by the library.
* QUIT, HELP, SET, and SHOW will be supported by default.
*/
const showandtell = require('showandtell')
const story = new showandtell.Story([
showandtell.commands.set,
showandtell.commands.show
])
let state = {test: 32}
story.start(state)
.then((newState) => {
console.log('new test value:', parseInt(state.test))
})
.catch(console.error)