npm.io
1.2.0 • Published 6 years ago

minimvc

Licence
ISC
Version
1.2.0
Deps
0
Size
5 kB
Vulns
0
Weekly
0

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