-
Notifications
You must be signed in to change notification settings - Fork 2
[Style API] Adds usePluginStyle hook and PluginStyle type #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/client/initialize.ts
Outdated
| }, | ||
|
|
||
| style: { | ||
| subscribeToStyle(callback: (style: any) => void) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super small, can we just call these subscribe and get? Makes more sense to do style.subscribe() than style.subscribeToStyle()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change getStyle to get?
peternandersson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, LGTM
src/client/initialize.ts
Outdated
| }, | ||
|
|
||
| style: { | ||
| subscribe(callback: (style: any) => void) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| subscribe(callback: (style: any) => void) { | |
| subscribe(callback: (style: PluginStyle) => void) { |
Adds a new style API with
styleon PluginInstance. Defines thePluginStyletype, currently supportingbackgroundColor.getStyle()– fetches the current style config viawb:plugin:style:getsubscribeToStyle()– listens for live updates viawb:plugin:style:updateusePluginStyle()React hookWill update readme when this is finalized.
Sample plugin app: