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
const machine = Machine({ | |
id: 'categoryList', | |
initial: 'loading', | |
context: { | |
}, | |
states: { | |
loading: { | |
invoke: { | |
src: "loadData", |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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
const loadData = (callback, receive) => { | |
const intervalId = setInterval(() => { | |
callback({type:"DATA", data: "data"}) | |
console.log("called") | |
}, 2500) | |
return () => clearInterval(intervalId) | |
} | |
const appMachine = Machine({ | |
id: 'app', |
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
const timelineMachine = Machine( | |
{ | |
id: "timeline", | |
initial: "idle", | |
context: {}, | |
on: { | |
"UPDATE_SPACES": { | |
actions: "assignSpaces" | |
}, | |
"ADMINISTER": "admin" |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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
interface Measurements { | |
x: number | |
y: number | |
width: number | |
height: number | |
pageX: number | |
pageY: number | |
} | |
export const useMeasure: () => [RefObject<View>, Measurements] = () => { |
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
const systemMachine = Machine({ | |
id: "system", | |
context: {}, | |
initial: "loading", | |
states: { | |
loading: { | |
id: "loadSystemData", | |
src: "loadSystemData", | |
onDone: { | |
target: "configure", |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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
const requestMachine = Machine( | |
{ | |
context: { | |
failGracefully: false, | |
tokenUpdated: false, | |
}, | |
id: "request", | |
initial: "loading", | |
on: { | |
REFRESH: ".loading", |
NewerOlder