Skip to content

Instantly share code, notes, and snippets.

@pyoner
Created December 4, 2019 04:20

Revisions

  1. pyoner created this gist Dec 4, 2019.
    14 changes: 14 additions & 0 deletions machine.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@

    // Available variables:
    // - Machine
    // - interpret
    // - assign
    // - send
    // - sendParent
    // - spawn
    // - raise
    // - actions
    // - XState (all XState exports)

    const fetchMachine = Machine({ "id": "root", "states": { "Job State Sketch": { "id": "Job State Sketch", "states": { "clientCounterOffer": { "id": "clientCounterOffer", "states": {}, "on": { "accept": "#termsAcceptedAwaitingEscrow", "decline": "#declined" } }, "declined": { "id": "declined", "states": {} }, "inDispute": { "id": "inDispute", "states": {}, "on": { "markAsComplete": "#complete" } }, "termsAcceptedAwaitingEscrow": { "id": "termsAcceptedAwaitingEscrow", "states": {}, "on": { "authorisedEscrow": "#authorisedEscrow" } }, "offer": { "id": "offer", "states": {}, "on": { "cancel": "#cancelled", "clientCounterOffer": "#clientCounterOffer", "decline": "#declined", "providerCounterOffer": "#providerCounterOffer" } }, "authorisedEscrow": { "id": "authorisedEscrow", "states": {}, "on": { "escrow": "#inEscrow" } }, "workPendingCompletion": { "id": "workPendingCompletion", "states": {}, "on": { "dispute": "#inDispute", "markAsComplete": "#complete" } }, "providerCounterOffer": { "id": "providerCounterOffer", "states": {}, "on": { "accept": "#termsAcceptedAwaitingEscrow", "clientCounterOffer": "#clientCounterOffer" } }, "complete": { "id": "complete", "states": {}, "on": { "review": "#reviewed" } }, "draft": { "id": "draft", "states": {}, "on": { "close": "#closed", "start": "#acceptingOffers" } }, "closed": { "id": "closed", "states": {} }, "cancelled": { "id": "cancelled", "states": {} }, "finishingJob": { "id": "finishingJob", "states": {} }, "processingEscrow": { "id": "processingEscrow", "states": {} }, "reviewed": { "id": "reviewed", "states": {} }, "inEscrow": { "id": "inEscrow", "states": {}, "on": { "markAsComplete": "#workPendingCompletion" } }, "init": { "id": "init", "states": {}, "on": { "draft": "#draft", "start": "#acceptingOffers" } }, "acceptingOffers": { "id": "acceptingOffers", "states": {}, "on": { "close": "#closed", "offer": "#offer" } } }, "initial": "init", "on": {} } }, "initial": "Job State Sketch", "on": {}});