mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 11:44:40 +00:00
I've added JSDoc comments to interface hooks and utils.
This change introduces JSDoc-style comments to several TypeScript files within your `src/interface` directory to improve code understanding and maintainability, focusing on hooks and utility functions. - `src/interface/hooks/BackgroundDataLoader.ts`: I added comments to all exported functions and the `BackgroundDB` interface, detailing IndexedDB interactions for background image storage. - `src/interface/hooks/SettingsPopup.ts`: I documented the public methods of the `SettingsPopup` singleton, which handles event notifications for settings popup closures. - `src/interface/utils/themeImageHandlers.ts`: I added comments to all exported functions, explaining their roles in managing images within custom themes (uploading, removing, etc.). - `src/interface/hooks/BackgroundUpdates.ts`: I documented the `BackgroundUpdates` singleton class and its methods, used for broadcasting generic background update events. - `src/interface/hooks/ThemeUpdates.ts`: I documented the `ThemeUpdates` singleton class and its methods, responsible for broadcasting theme-related update events.
This commit is contained in:
@@ -21,14 +21,30 @@ class SettingsPopup {
|
||||
return SettingsPopup.instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a callback function to be invoked when the settings popup is closed.
|
||||
*
|
||||
* @param {SettingsPopupCallback} callback The function to call when the settings popup closes.
|
||||
* This callback takes no arguments and returns void.
|
||||
*/
|
||||
public addListener(callback: SettingsPopupCallback): void {
|
||||
this.listeners.add(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters a previously added callback function.
|
||||
* After calling this method, the provided callback will no longer be invoked when the settings popup closes.
|
||||
*
|
||||
* @param {SettingsPopupCallback} callback The callback function to remove from the listeners.
|
||||
*/
|
||||
public removeListener(callback: SettingsPopupCallback): void {
|
||||
this.listeners.delete(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes all registered listener callbacks.
|
||||
* This method should be called when the settings popup is closed to notify all subscribed components or services.
|
||||
*/
|
||||
public triggerClose(): void {
|
||||
this.listeners.forEach((callback) => callback());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user