SAM-JS
Note: Although this is working, this project is still under development and you should not use it for production because the API may still change.
What is SAM-JS
SAM-JS is a lightweight library for building applications in the SAM architecture.
It intends to extend the discussion about SAM happening in Gitter.
What is SAM
SAM is a new reactive/functional pattern that simplifies Front-End architectures by clearly separating the business logic from the view and, in particular, strictly decoupling back-end APIs from the Front-End. SAM is technology independent and as such can be used to build Web Apps or Native Apps. It is also protocol independent and can be implemented over HTTP, WebSockets...
SAM is unapologetically driven by simplicity and challenges the complexity of frameworks like Google's Angular or Facebook's React+JSX+Flux/Redux+Saga+Thunk+GraphQL+Relay.
Developer tools
Example
Check the working example with devtools.
The gist
Increases the counter by clicking INC. Launches when counter reaches 10.
// Input: Current store, dataset presented// Output: New storeconst container = { if datasetincreaseBy !== undefined storecounter += datasetincreaseBy if datasetlaunch storelaunched = true return store} // Input: Store (from Model)// Output: State (to View and nap)const state = { return counter: storecounter launchImminent: storecounter == 9 hasLaunched: storelaunched ? true : false } // Input: State// Output: NAP, i.e. a function which accepts a function (present) and may or may not call itconst nap = { return { if statecounter == 10 && statehasLaunched != true }} const initialStore = counter: 0 // Input: Model// Output: Dispatch, i.e. a function which accepts an action and presents values to the modelconst createDispatch = { } const model = const dispatch = // You may render the View however you wish// e.g. with Reactmodel