This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Current version copied from https://github.com/open-wa/wa-automate-nodejs/blob/master/src/lib/wapi.js | |
| if (!window.Store||!window.Store.Msg) { | |
| (function () { | |
| function getStore(modules) { | |
| let foundCount = 0; | |
| let neededObjects = [ | |
| { id: "Store", conditions: (module) => (module.default && module.default.Chat && module.default.Msg) ? module.default : null}, | |
| { id: "MediaCollection", conditions: (module) => (module.default && module.default.prototype && (module.default.prototype.processFiles !== undefined||module.default.prototype.processAttachments !== undefined)) ? module.default : null }, | |
| { id: "MediaProcess", conditions: (module) => (module.BLOB) ? module : null }, | |
| { id: "Archive", conditions: (module) => (module.setArchive) ? module : null }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const loanMachine = Machine({ | |
| id: 'loan', | |
| initial: 'PAYMENT_DETAILS', | |
| context: { | |
| cosigners: 0, | |
| awesome: false, | |
| }, | |
| states: { | |
| PAYMENT_DETAILS: { | |
| on: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const underwritingStates = { | |
| id: "underwriting", | |
| initial: "PENDING", | |
| states:{ | |
| PENDING: { | |
| on: { | |
| approve: "APPROVED", | |
| reject: "REJECTED", | |
| ask_for_cosigner: "COSIGNER_NEEDED" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const nstates = { | |
| id: "pre call", | |
| initial: "a", | |
| states: { | |
| a: { | |
| on: { | |
| X: 'b' | |
| } | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const roomMachine = Machine({ | |
| id: '100ms rooms', | |
| initial: 'home', | |
| context: { | |
| isPermissionGiven: false, | |
| isNew: true | |
| }, | |
| states: { | |
| home: { | |
| on: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const webSocketMachine = Machine({ | |
| id: "Web Socket", | |
| initial: "connecting", | |
| states: { | |
| connecting:{ | |
| on: { | |
| SUCCESS: "open", | |
| ERROR: "closed" | |
| } | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const bucketMachine = Machine({ | |
| id: 'fetch', | |
| initial: "There's a hole in my bucket", | |
| states: { | |
| "There's a hole in my bucket": { | |
| on: { | |
| THEN_FIX_IT: 'With what should I fix it?' | |
| } | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const sum = x => y => y ? sum(x+y) : x |