mirror of
https://github.com/ahmadk953/poixpixel-discord-bot.git
synced 2025-04-02 09:44:14 +00:00
27 lines
No EOL
719 B
TypeScript
27 lines
No EOL
719 B
TypeScript
import * as l_util from "./util";
|
|
|
|
export class Config<Config_Interface> {
|
|
public readonly defaulted: Config_Interface;
|
|
#real: Config_Interface;
|
|
|
|
public events = {
|
|
change: [] as unknown as (() => {})[]
|
|
};
|
|
|
|
constructor(
|
|
defaulted: Config_Interface,
|
|
real: Config_Interface
|
|
) {
|
|
this.defaulted = defaulted;
|
|
this.#real = l_util.object.merge.recursive_merge(defaulted, real);
|
|
}
|
|
|
|
public set real(new_real: Config_Interface) {
|
|
this.#real = l_util.object.merge.recursive_merge(this.defaulted, new_real);
|
|
this.events.change.forEach((event_callback: any) => event_callback());
|
|
}
|
|
|
|
public get real() {
|
|
return this.#real;
|
|
}
|
|
} |