Skip to content

Instantly share code, notes, and snippets.

@edgerunner
Created October 6, 2020 23:43
Show Gist options
  • Save edgerunner/b1bd3e6d8d1d0f7c59608ae2f5219ae1 to your computer and use it in GitHub Desktop.
Save edgerunner/b1bd3e6d8d1d0f7c59608ae2f5219ae1 to your computer and use it in GitHub Desktop.
SWR&
SWR&
Data
success -> Fresh
None
Some
Fresh
after stale -> Stale
Stale
Transfer
after stale -> Pending
Pending
success -> Done
failure -> Failed
Done
Failed
after retry -> Pending
function render(model){
analyse(model, "Tolga")
let current_state_name = model.active_states.map(s => s.name);
return $("h1",
{style: {color: "darkBlue"}},
`The current state is: ${current_state_name}`);
}
function analyse(machine, input) {
for (char in input.toLowerCase()) {
if ("aeıioöuü".includes(char)) {
machine.emit(char)
} else {
machine.emit("consonant")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment