@ue-too/being / index / createVendingMachine
函式: createVendingMachine()
createVendingMachine():
TemplateStateMachine<VendingMachineEvents,BaseContext,VendingMachineStates,DefaultOutputMapping<VendingMachineEvents>>
定義於: vending-machine-example.ts:193
Creates a demo vending machine used by tests and the examples visualizer.
回傳
TemplateStateMachine<VendingMachineEvents, BaseContext, VendingMachineStates, DefaultOutputMapping<VendingMachineEvents>>
備註
A 4-state machine (IDLE, ONE_DOLLAR_INSERTED, TWO_DOLLARS_INSERTED, THREE_DOLLARS_INSERTED) modeling a simple vending machine that accepts one-dollar bills and dispenses a Coke, Red Bull, or water once enough money has been inserted, with a cancelTransaction event to refund and return to IDLE. Each call returns a machine with its own context.