The fast, small and functional JavaScript library for building web user interfaces.
Install
Npm: npm install flamer
CDN: https://unpkg.com/flamer@0.0.4
The Gist:
; // Initial Application Stateconst applicationState = text: 'Click' title: 'Flamer.js' // Event Handlerconst Event = { } /** * Each Reactive component are pure function that returns * a template string. */const Button = /** * Minimal DOM Updates * [flamer-observe] when the reactive event be called, * the Reactive function will be called */const Title = /** * The Container lyfecycle * beforeRender -> Trigger before the Container be rendered * afterRender -> Trigger after the Container are rendered */ const ApplLifecycle = console console /** * The Container Component that will * be render inside the DOM * It's a function that return an object */ const App = { return ` <div> </div>` } AppLifecycle; // The container will receive the appliactionState as argument;
API
Container
/** * @name Container * @description Create your Container Component. Container doesn't have state itself, just * iteract with it when render. It keeps more simple the flow. * @param * @param */ App lifecycle;
Reactive
/** * @name Reactive * @description Your reactive component that will * bind the flamer-observe event * @param * e.g update('text', value) // text -> Reactive Component * @param * returned when the event name are called */
render
/** * @name render * @description Render the container inside the dom * It keeps more simple the flow. Container doesn't have state itself, just * iteract with it when render * @param * @param * @param */ ;
[flamer-observe]
<!-- * @name flamer-observe * @description The tag element that will be updated when the reactive event be called * When the title reactive event be called, the flamer-observe element will be updated. * Keep the minimal DOM update **/ --> Initial Title
Reactive Methods:
update
/** * Use when you want change update the respective Reactive element * @name update * @description Update the state * @param * @param */ ;
append
/** * Use when you want to add the respective Reactive element * @name append * @description Update your flamer-observe component * @param * @param */ ;
remove
/** * Use when you want to remove the respective Reactive element * @name append * @description Update your flamer-observe component * @param * @param */ ;
replace
/** * Use when you want to replace the respective Reactive element * @name replace * @description Update your flamer-observe component * @param * @param * @param */ ;
License MIT