Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfftdammitchris/4cc5d6c1c343c02eb63427896d49228f to your computer and use it in GitHub Desktop.
Save pfftdammitchris/4cc5d6c1c343c02eb63427896d49228f to your computer and use it in GitHub Desktop.
registerCommand(
'SET_BACKGROUND_COLOR',
function onSetState({ backgroundColor }) {
setState((prevState) => ({ ...prevState, backgroundColor }))
},
)
registerCommand('NOTIFY_SUBSCRIBERS', function onNotifySubscribers(...args) {
subscribers.forEach((fn) => fn(...args))
})
registerCommand('ADD_PROFILE', function onAddProfile(profile) {
setState((prevState) => ({
...prevState,
profiles: prevState.profiles.concat(profile),
}))
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment