minimvc
v1.2.0
Published
Lightweight mvc for basic data binding between a json object and the DOM
Downloads
8
Readme
MiniMVC
MiniMVC is a lightweight solution to bind javascript objects to DOM elements
Get Started
1. Include the module
import MVC from "https://unpkg.com/minimvc";
2. Initialise MiniMVC
let data = {
header = "My first blog post"
}
let mvc = new MVC({data});
3. Edit the DOM
<h1 data-bind="header"></h1>
<p data-bind="paragraph">
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Pariatur rerum
consectetur nemo accusantium, quos nisi fuga eius explicabo! Est qui commodi,
doloribus fugiat in eveniet iste iure neque voluptatem vel.
</p>
Parameters
MiniMVC can accept two parameters
| Parameter | Description | Default | | ------------- | ------------------------------------------------------------------------------ | ----------------- | | data | An Object that contains all of the data that is to be syncronised with the DOM | MiniMVC.data = {} | | bindAttribute | The attribute that will be used in the HTML to identify it's data equivelent | data-bind |
TODO:
- Support Nested data object