@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>>
Remarks
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.