// Available variables: // - Machine // - interpret // - assign // - send // - sendParent // - spawn // - raise // - actions // - XState (all XState exports) const fetchMachine = Machine({ id: 'fetch', initial: 'active', context: { past: [], current: null, queue: [1, 2, 3] }, states: { active: { type: "parallel", states: { past: { initial: "empty", states: { empty: {}, filled: {} } }, current: { initial: "empty", states: { empty: {}, filled: {} } }, queue: { initial: "empty", states: { empty: {}, filled: { on: { MOVE: { target: "empty", actions: assign({}), cond: "hasNext" } } } } } } } } }, { guards: { hasCurrent: context => !!context.current, hasNext: context => context.queue.length > 0 } });