Skip to content

Commit 882bb9b

Browse files
committed
rename
1 parent 1609ed0 commit 882bb9b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/client/initialize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
},

src/react/hooks.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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;

src/types.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff 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
/**

0 commit comments

Comments
 (0)