Last active
February 21, 2022 01:00
-
-
Save marionebl/484d3ce6b078caab5542c0f2a849818a to your computer and use it in GitHub Desktop.
Canvas sync states
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
Canvas sync states | |
Loading | |
loaded -> Synced | |
disconnected -> Offline | |
Synced | |
changed -> Syncing | |
disconnected -> Offline | |
Syncing | |
synced -> Synced | |
disconnected -> Offline | |
Offline | |
connected -> Syncing | |
wait -> Disconnected | |
Disconnected | |
connected -> Disconnected Syncing | |
Disconnected Syncing | |
synced -> Reconnected | |
disconnected -> Disconnected | |
Reconnected | |
wait -> Synced | |
disconnected -> Offline |
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 states = { | |
'Loading': ['', ''], | |
'Synced': ['☑️ ', 'Changes saved'], | |
'Syncing': ['🔄 ', 'Saving...'], | |
'Offline': ['⛈ ', 'You’re offline. We’ll sync changes when you’re back.'], | |
'Disconnected': ['⛈ ', 'You’re offline. We’ll sync changes when you’re back.', 'You’re offline. We’ll sync changes when you’re back.'], | |
'Disconnected Syncing': ['🔄 ', 'Reconnecting...'], | |
'Reconnected': ['☑️ ', 'Reconnected', 'You are back!'], | |
} | |
function render(model){ | |
let current_state_name = model.active_states[0].name; | |
const state = states[current_state_name]; | |
return $("div", {}, [ | |
$("div", { style: { margin: 15 } }, [state[0], [state[1]]]), | |
state[2] ? $("div", { style: { margin: '0 auto', width: '200px', color: 'white', background: 'black', padding: 3 } }, [state[2]]): null | |
]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment