Miss any of our Open RFC calls?Watch the recordings here! »

commander-sam

1.0.2 • Public • Published

commander-sam

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.

USAGE

npm start

const commander = Commander()
const render = commander.invoke.bind(commander, Actions.RenderView)
const model = Model(render)
const view = View(commander.invoke)
 
commander.subscribe(
  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)),
)
 
commander.invoke(Actions.Startup)

Install

npm i commander-sam

DownloadsWeekly Downloads

6

Version

1.0.2

License

ISC

Last publish

Collaborators

  • avatar