Appleseed
A lightweight implementation of the Elm data model using javascript.
Example
Definition
; const ui = el: el toggle: el close: el open: el body: documentbody; const init = isOpen: uielclassList; const subscriptions = { const elClick = { if uitoggle ; if uiopen ; if uiclose ; }; const bodyClick = { if !uiel ; }; uiel; uibody; return { uiel; uibody; }} const update = { } const view = { if updateisOpen !== undefined // only update if the data has been updated uielclassList; } ui init subscriptions update view ;
Useage
; // creating a component returns a // function to unsubscribe event listenersconst unsubscribeToggler = ; // remove event listeners to effectively // stop the component from behaving;
Docs
Types
ui : { el : DomNode, options : Maybe Object } => Dict { String : DomNode } init : { ui : Dict { String : DomNode } } => Object subscriptions : { state : Object, ui : Object, pushUpdate : Function, options : Object } => Function update : { message : String, state : Object, lastState : Object, options : Object } => Function view : { ui : Dict { String : DomNode }, update : Object, lastState: Object, history : List (List String), options : Object } createComponent : { ui : Maybe Function, init : Maybe Function, subscriptions : Maybe Function update : Maybe Function, view : Maybe Function}
Install
npm install appleseed