File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ export function initialize<T = {}>(): PluginInstance<T> {
115115 return pluginConfig . themeColors ;
116116 } ,
117117
118- subscribeToThemeColors ( callback : ( themeColors : PluginThemeColors ) => void ) {
118+ onThemeChange ( callback : ( themeColors : PluginThemeColors ) => void ) {
119119 on ( 'wb:plugin:theme:update' , callback ) ;
120120 return ( ) => off ( 'wb:plugin:theme:update' , callback ) ;
121121 } ,
Original file line number Diff line number Diff line change @@ -257,8 +257,10 @@ export function useThemeColors(): PluginThemeColors | undefined {
257257 const [ themeColors , setThemeColors ] = useState ( client . themeColors ) ;
258258
259259 useEffect ( ( ) => {
260+ // Initial sync
260261 setThemeColors ( client . themeColors ) ;
261- return client . subscribeToThemeColors ( setThemeColors ) ;
262+
263+ return client . onThemeChange ( setThemeColors ) ;
262264 } , [ client ] ) ;
263265
264266 return themeColors ;
Original file line number Diff line number Diff line change @@ -208,13 +208,11 @@ export interface PluginInstance<T = any> {
208208 themeColors ?: PluginThemeColors | undefined ;
209209
210210 /**
211- * Subscribe to theme color changes
211+ * Listen to theme color changes
212212 * @param {Function } callback Function to call when theme colors change
213213 * @returns {Function } Unsubscriber function
214214 */
215- subscribeToThemeColors (
216- callback : ( themeColors : PluginThemeColors ) => void ,
217- ) : ( ) => void ;
215+ onThemeChange ( callback : ( themeColors : PluginThemeColors ) => void ) : ( ) => void ;
218216
219217 config : {
220218 /**
You can’t perform that action at this time.
0 commit comments