Tinyflow JS

Workflows everywhere!

$ npm install @tinyflow/core
$ yarn add @tinyflow/core
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tinyflow/core">
· ·

Most Minimal Example

import { Workflow } from '@tinyflow/core' // create a new workflow const workflow = new Workflow({ name: 'checkout-cart', steps: { visit: {}, paymentOptions: {}, complete: {} } }) // listen to workflow events workflow.on('started', () => console.debug('workflow started')) workflow.on('step', () => console.debug('new step is mounted', workflow.current)) workflow.on('error', ({ error }) => console.error(error)) workflow.on('end', () => { workflow.off() // remove all events console.debug('workflow ended with data', workflow.data) }) workflow.start() // ... at some point in your code // update the current step's data workflow.current.update({ some: 'data' }) // or complete the current step, causing // workflow to move to the next step or end workflow.current.complete()

API Docs