config,backend-common: move config subscribe method to the base config interface

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-08-12 12:49:45 +02:00
parent b89f04d9f7
commit 90f25476ac
10 changed files with 33 additions and 41 deletions
+3
View File
@@ -16,6 +16,9 @@ export type AppConfig = {
//
// @public (undocumented)
export type Config = {
subscribe?(onChange: () => void): {
unsubscribe: () => void;
};
has(key: string): boolean;
keys(): string[];
get<T = JsonValue>(key?: string): T;
+11
View File
@@ -26,6 +26,17 @@ export type AppConfig = {
};
export type Config = {
/**
* Subscribes to the configuration object in order to receive a notification
* whenever any value within the configuration has changed.
*
* This method is optional to implement, and consumers need to check if it is
* implemented before invoking it.
*/
subscribe?(onChange: () => void): {
unsubscribe: () => void;
};
has(key: string): boolean;
keys(): string[];