UNPKG

state-switch

Version:

State Switch is a Change Monitor/Guarder for Async Actions.

76 lines 1.37 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.config = void 0; const inactive = { // entry : 'onEntry', // exit : 'onExit', on: { START: 'starting', }, }; const starting = { invoke: { onDone: 'active', onError: 'canceled', src: 'start', }, on: { CANCEL: 'inactive', }, }; const active = { // entry : 'onEntry', // exit : 'onExit', on: { RESET: 'resetting', STOP: 'stopping', }, }; const stopping = { invoke: { onDone: 'inactive', onError: 'canceled', src: 'stop', }, on: { CANCEL: 'inactive', }, }; const resetting = { invoke: { onDone: 'active', onError: 'canceled', src: 'reset', }, on: { CANCEL: 'inactive', }, }; const canceled = { // entry : 'onEntry', // exit : 'onExit', on: { RESET: 'resetting', START: 'starting', STOP: 'stopping', }, }; const states = { active, canceled, inactive, resetting, starting, stopping, }; const initialContext = () => ({ counter: 0, }); const config = { context: initialContext(), id: 'ServiceCtlMachine', initial: 'inactive', states, }; exports.config = config; //# sourceMappingURL=machine-config.js.map