Created
November 14, 2022 06:31
-
-
Save pfftdammitchris/0fb7bf325ebd9f7cd9953137d56c6c38 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