vue-robot
v0.0.8
Published
Vue wrapper for [Robot](https://github.com/matthewp/robot)
Downloads
16
Readme
Vue Robot
Vue wrapper for Robot
Example
<template lang="pug">
button(
type="button"
:click="send('toggle')"
)
| {{ state.name }}
</template>
<script setup>
import { useMachine } from 'vue-robot';
import { createMachine } from 'robot3';
const toggleMachine = createMachine({
on: state(
transition('toggle', 'off')
),
off: state(
transition('toggle', 'on')
)
});
const { currentState, send } = useMachine(toggleMachine);
</script>
API
useMachine(machine, initialContext?)
...
Arguments
machine
initialContext
Returns { currentState, send, service}
:
currentState
send
service