The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Original post
| const windowMachine = Machine({ | |
| id: 'window', | |
| initial: 'open', | |
| context: { | |
| }, | |
| states: { | |
| open: { | |
| initial: 'floating', | |
| states: { |
| const validate = ({ value, validator }) => { | |
| if (validator === undefined) { | |
| return new Promise((resolve) => resolve()) | |
| } | |
| return validator.validate(value) | |
| } | |
| const inputMachine = Machine({ | |
| id: 'input', | |
| initial: 'valid', |
| const schemaMachineConfig = { | |
| initial: 'idle', | |
| context: { | |
| schemaToLoad: undefined, | |
| schemas: {} | |
| }, | |
| states: { | |
| idle: { |
| const debugDelay = 2500 | |
| const FormMachine = Machine({ | |
| id: 'form', | |
| initial: 'idle', | |
| context: { | |
| testId: 34, | |
| schema: undefined, | |
| entity: undefined, | |
| errorMessage: undefined, |
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |