Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including commander-sam with all npm packages installed. Try it out:

var commanderSam = require("commander-sam")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

commander-sam v1.0.2

DIY MVC Framework inspired by SAM pattern.


DIY MVC Framework inspired by SAM pattern for my Coding Dojo.

This is an example of Todo list application (obviously!).

It separates concerns with Commands, Model and View. Has Redux inspired time travel, and component rendering inspired by React.

It's basically a DIY way of building simple web apps without reaching for heavy React/Redux libraries.


npm start

const commander = Commander()
const render = commander.invoke.bind(commander, Actions.RenderView)
const model = Model(render)
const view = View(commander.invoke)

  Command(Actions.Startup, () => model.propose(Actions.Startup)),
  Command(Actions.Back, () => model.propose(Actions.Back)),
  Command(Actions.Forward, () => model.propose(Actions.Forward)),
  Command(Actions.AddToDo, todo => model.propose(Actions.AddToDo, todo)),
  Command(Actions.RenderView, state => view.render(state)),

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free