UNPKG

state-switch

Version:

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

57 lines 2 kB
/** * Licenst: Apache-2.0 * https://github.com/huan/state-switch */ import { Interpreter } from 'xstate'; import { ServiceableAbstract, StateSwitchInterface, StateSwitchOptions } from '../interfaces.js'; import type { ServiceCtlContext, ServiceCtlEvent, ServiceCtlState } from './machine-config.js'; import type { Loggable } from 'brolog'; declare const serviceCtlFsmMixin: (serviceCtlName?: string, options?: StateSwitchOptions | undefined) => <SuperClass extends typeof ServiceableAbstract>(superClass: SuperClass) => ((abstract new (...args: any[]) => { /** * Huan(202110): this state is simple record the start/stop status */ state: StateSwitchInterface; __serviceCtlLogger: Loggable; __serviceCtlFsmInterpreter: Interpreter<ServiceCtlContext, ServiceCtlState, ServiceCtlEvent>; start(): Promise<void>; stop(): Promise<void>; reset(): Promise<void>; /** * onStart & onStop must be implemented by the child class */ onStart(): Promise<void>; onStop(): Promise<void>; emit(..._: any[]): any; }) & { VERSION: string; }) & SuperClass; declare const ServiceCtlFsm_base: ((abstract new (...args: any[]) => { /** * Huan(202110): this state is simple record the start/stop status */ state: StateSwitchInterface; __serviceCtlLogger: Loggable; __serviceCtlFsmInterpreter: Interpreter<{ counter: number; }, ServiceCtlState, ServiceCtlEvent, { value: any; context: { counter: number; }; }>; start(): Promise<void>; stop(): Promise<void>; reset(): Promise<void>; /** * onStart & onStop must be implemented by the child class */ onStart(): Promise<void>; onStop(): Promise<void>; emit(..._: any[]): any; }) & { VERSION: string; }) & typeof ServiceableAbstract; declare abstract class ServiceCtlFsm extends ServiceCtlFsm_base { } export { ServiceCtlFsm, serviceCtlFsmMixin, }; //# sourceMappingURL=service-ctl-fsm.d.ts.map