This file contains 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
{ | |
"link": "djcb.link/cwg", | |
"name": "Christian Nwamba", | |
"twitter": "https://twitter.com/codebeast", | |
"bio": "Senior Cloud Advocate @ Microsoft", | |
"title": "DJ Coding", | |
"prerequisites": [ | |
{"Sonic Pi": "https://sonic-pi.net/"}, | |
{"VS Code": "https://code.visualstudio.com/"} | |
], |
This file contains 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
{ | |
"link": "djcb.link/t3s", | |
"name": "Christian Nwamba", | |
"twitter": "https://twitter.com/codebeast", | |
"bio": "Senior Cloud Advocate @ Microsoft", | |
"title": "Building Schedulers with Durable Functions", | |
"prerequisites": [ | |
{"VS Code": "https://code.visualstudio.com/"}, | |
{"Node.js": "https://nodejs.org/"}, | |
{"Azure Functions Core Tools": "https://github.com/Azure/azure-functions-core-tools"}, |
This file contains 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
// DEMO: Call events in child machines | |
// NOTE: Child machine viz is not supported yet | |
const childMachine = Machine({ | |
id: 'child', | |
initial: 'step1', | |
states: { | |
step1: { | |
on: { STEP: 'step2' }, |
This file contains 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
// DEMO: Call events anywhere (including parent machines/states) with callbacks | |
const echoCallbackHandler = (context, event) => | |
(callback, onEvent) => { | |
onEvent(e => { | |
if(e.type === 'HEAR') { | |
callback('ECHO') | |
} | |
}) | |
} |
This file contains 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
// DEMO: Async and Promises | |
const fetchCuteAnimals = () => { | |
// Uncomment to test failure | |
// return Promise.reject() | |
return fetch('https://www.reddit.com/r/aww.json') | |
.then(res => res.json()) | |
.then(data => data.data.children.map(child => child.data)) | |
} |
This file contains 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
//DEMO: Delay Events and | |
// Use after instead of `on` for timer events | |
const states = { | |
green: { | |
after: { | |
RED_TIMER: 'yellow' | |
} | |
}, |
This file contains 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
// DEMO: Null or Transient Transitions with '' | |
// Cick TRY 3 times and it will get to success but will keep coming back to idle at 1 and 2 time | |
// You can see the state increment in the STATE tab when you click TRY | |
const ifAtFirstYouDontSucceed = Machine( | |
{ | |
id: 'tryTryAgain', | |
initial: 'idle', | |
context: { | |
tries: 0, |
This file contains 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
// DEMO: History State Deep | |
const heatedStates = { | |
lowHeat: { | |
on: { TOGGLE_HEAT: 'highHeat' } | |
}, | |
highHeat: { | |
on: { TOGGLE_HEAT: 'lowHeat' } | |
} | |
} |
This file contains 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
// DEMO: History State (Shallow) | |
const poweredOnStates = { | |
lowHeat: { | |
on: { TOGGLE_HEAT: 'highHeat' } | |
}, | |
highHeat: { | |
on: { TOGGLE_HEAT: 'lowHeat' } | |
}, |
This file contains 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
// DEMO: Guarding | |
const vendingMachineMachine = Machine( | |
{ | |
id: "vendingMachine", | |
initial: "idle", | |
context: { | |
deposited: 0 | |
}, | |
states: { |
NewerOlder