This is a MVC framework made entirely in JS proof of concept p.1.0.0
instructions
-
link the min.js in html and no further imports will be needed anywhere else
-
to set data use this in any js file
state.controllers.set_data('foo', 'bar')
- to display the data in html, call it with double curly braces, and any time the data is changed it will be reflected in the DOM
<h1>{{foo}}</h1>
- theme detection is automatic but you can set your own custom them with state.controllers.set_theme("custom_theme") you can define your custom theme in state.themes in this format
custom_theme:{
primary: '#050808',
secondary: '#86e9a5',
accent : '#ff8847',
}
- you can use loops with
<loop count="{{foo}}"><h2>this is the item that will be repeated</h2></loop>
please note that the loop only works with one child element
- you can set inputs with
<input type="text" value="{{foo}}">
~~~JS
state.controllers.set_input('foo', 'bar') // bar will show as the placeholder