3.0.3 • Published 6 years ago

mulan v3.0.3

Weekly downloads
22
License
MIT
Repository
github
Last release
6 years ago

Mulan Js

ES6 Template Literal component library.

Installation

npm install mulan --save yarn add mulan

API

createRenderer(DOM Node, Function) Takes a DOM Node and a function, which is supplied a render function. Returns the root and the render function.

Example:

import {createRenderer} from 'mulan'
import delegate from 'delegate-events'

const Results = (render, root) => {
  delegate.bind(root, '[data-item]', 'click', (e) => {
    console.log(e.target.dataset.item)
  })

  render(`
    <ul>
      <li data-item="1">1</li>
      <li data-item="2">2</li>
      <li data-item="3">3</li>
    </ul>
  `)
}

const Things = () => (`
  <p>This is some things</p>
`)

const App = ({title}) => (render, root) => {
  delegate.bind(root, '#button', 'click', () => {
    createRenderer(document.getElementById('result'), Results)
  })

  render(`
    <div>
      <h1>${title}</h1>
      <button id="button">Click Me!</button>
      <div id="result"></div>

      ${Things()}
    </div>
  `)
}

createRenderer(document.getElementById('app'), App({ title: 'This is Mulan' }))

Mulan

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago