0.3.0 • Published 1 year ago

haunted-robot v0.3.0

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

haunted-robot

Haunted hooks for use with Robot.

See documentation on the website.

import { useMachine } from 'haunted-robot';
import { html, component } from 'haunted';
import { createMachine, state, transition } from 'robot3';

const machine = createMachine({
  one: state(
    transition('next', 'two')
  ),
  two: state()
});

function App() {
  const [current, send] = useMachine(machine);
  
  return html`
    <button type="button" @click=${() => send('next')}>
      State: ${current.name}
    </button>
  `;
}

customElements.define('my-app', component(App));

📚 Documentation

License

BSD-2-Clause