Created
November 14, 2022 07:29
-
-
Save pfftdammitchris/4cc5d6c1c343c02eb63427896d49228f to your computer and use it in GitHub Desktop.
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
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