Skip to content

Commit

Permalink
fix: reconstructing the data structure
Browse files Browse the repository at this point in the history
  • Loading branch information
ChoGathK committed Oct 15, 2022
1 parent 528825b commit 21667bb
Showing 1 changed file with 38 additions and 29 deletions.
67 changes: 38 additions & 29 deletions src/common/interface/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,40 @@
interface Observer {
export interface IObserver {
/**
* Register the subscriber inside client by the key of configuration.
*
* @param ...args: any[]
*
* @publicApi
*/
subscribe: (...args: any[]) => void | Promise<void>;
/**
* Remove the subscriber from client by the key of configuration..
*
* @param ...args: any[]
*
* @publicApi
*/
unSubscribe: (...args: any[]) => void;
/**
* Notify subscribers of configuration updates.
*
* @param ...args: any[]
*
* @publicApi
*/
notify: (...args: any[]) => void;
/**
* Open the polling.
*
* @publicApi
*/
polling?: (...args: any[]) => void;
/**
* Close the polling.
*
* @publicApi
*/
unPolling?: () => void;
}

export interface IConfig<T = any> {
Expand Down Expand Up @@ -63,13 +96,13 @@ export interface IConfigClientSubscriber {
update: (value: any) => void | Promise<void>
}

export interface IConfigLoader {
export interface IConfigLoader<T = any> {
/**
* Load configuration.
*
* @publicApi
*/
execute: <T = any>() => T | Promise<T>;
execute: () => T | Promise<T>;
}

export interface IConfigPoller {
Expand All @@ -87,7 +120,7 @@ export interface IConfigPoller {
close: () => void | Promise<void>;
}

export interface IConfigObserver extends Observer {
export interface IConfigObserver extends IObserver {
/**
* Register the subscriber inside client by the key of configuration.
*
Expand All @@ -114,21 +147,9 @@ export interface IConfigObserver extends Observer {
* @publicApi
*/
notify: (key: string, value: any) => void;
/**
* Open the polling.
*
* @publicApi
*/
polling?: (...args: any[]) => void;
/**
* Close the polling.
*
* @publicApi
*/
unPolling?: () => void;
}

export interface IConfigClient extends Observer {
export interface IConfigClient extends IObserver {
/**
* Load configuration.
*
Expand Down Expand Up @@ -159,16 +180,4 @@ export interface IConfigClient extends Observer {
* @publicApi
*/
notify: (value: any) => void;
/**
* Open the polling.
*
* @publicApi
*/
polling?: (...args: any[]) => void;
/**
* Close the polling.
*
* @publicApi
*/
unPolling?: () => void;
}

0 comments on commit 21667bb

Please sign in to comment.