Skip to content

Instantly share code, notes, and snippets.

@pfftdammitchris
Created November 14, 2022 06:31
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/0fb7bf325ebd9f7cd9953137d56c6c38 to your computer and use it in GitHub Desktop.
Save pfftdammitchris/0fb7bf325ebd9f7cd9953137d56c6c38 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