Skip to content

Latest commit

 

History

History
76 lines (57 loc) · 1.29 KB

README.md

File metadata and controls

76 lines (57 loc) · 1.29 KB

Mirlo
- Another Simple JavaScript WC -

Static Badge Tests

Installation

npm i mirlo --save-dev

Basic Example

  • HTML:
<template id="template-mirlo-demo">
  <span id="msg"></span>
</template>

<mirlo-demo id="demo"></mirlo-demo>
  • JS 'Component':
import {Component, registerComponent} from 'mirlo';

export default class Demo extends Component {
  onSetup() {
    Component.useStateBinds({
      msg: {
        id: 'msg',
        attribute: 'html',
      },
    });
    Component.useEvents({
      msg: {
        mode: 'id',
        events: {
          click: this.onClickMessage,
        },
      },
    });
  }

  onStart() {
    super.onStart();
    this.mirlo.state.msg = '<strong>Hello World!</strong>';
  }

  onClickMessage() {
    this.mirlo.state.msg = '<strong>Clicked!</strong>';
  }
}

registerComponent('demo', Demo);
  • JS 'Main':
import './components/demo01';

Documentation

https://tardo.github.io/mirlo/