Skip to content

Instantly share code, notes, and snippets.

View Valkendorm's full-sized avatar

Martin Asnong Valkendorm

  • Ubisoft Montreal
  • Montreal, Quebec, Canada
  • X @Valkendorm
View GitHub Profile
@Valkendorm
Valkendorm / machine.js
Last active June 22, 2020 13:19
Generated by XState Viz: https://xstate.js.org/viz
const readOnlyMachine = Machine({
id: "readOnly",
initial: "listing",
context: {
id: null
},
states: {
listing: {
on: {
READ: {
const managerMachine = Machine({
id: 'manager',
initial: 'pending',
context: {
space: null,
environment: null
},
states: {
@Valkendorm
Valkendorm / machine.js
Last active February 11, 2021 21:08
Generated by XState Viz: https://xstate.js.org/viz
const FLIGHT_PER_MINUTE = 1;
const BASIC_CHARGER = 1.2;
const FAST_CHARGER = 2.4;
const ONE_MINUTE = 1000 * 60;
const MIN_CHARGE = 0;
const MAX_CHARGE = 100;
const getBatteryCapacity = (timeInMinutes) => {
return FLIGHT_PER_MINUTE * timeInMinutes;
}
@Valkendorm
Valkendorm / machine.js
Last active February 24, 2021 13:59
Generated by XState Viz: https://xstate.js.org/viz
const EMPTY_TANK = 0;
const toiletMachine = Machine({
id: 'toilet',
context: {
flushSpeed: 1,
fillSpeed: 0.5,
tankAmount: 6,
tankCapacity: 6
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions