0.3.0 • Published 1 year ago

lit-robot v0.3.0

Weekly downloads
7
License
BSD-2-Clause
Repository
github
Last release
1 year ago

lit-robot

LitElement integration with Robot.

See documentation on the website.

import { Robot } from 'lit-robot';
import { LitElement, html } from 'lit-element';
import { html } from 'htm/prect';

class MyApp extends Robot(LitElement) {
  static machine = createMachine({
    one: state(
      transition('next', 'two')
    ),
    two: state()
  });

  render() {
    let { send } = this.service;
    let current = this.machine.state;

    return html`
      <button type="button" @click=${() => send('next')}>
        State: ${current.name}
      </button>
    `;
  }
}

📚 Documentation

License

BSD-2-Clause