derz / vue-robot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About


Languages

Language:JavaScript 100.0%