27 lines
555 B
JavaScript
27 lines
555 B
JavaScript
export class Settings {
|
|
static #props = {};
|
|
|
|
static get(property) {
|
|
return this.#props[property];
|
|
}
|
|
|
|
static add(property, value) {
|
|
if (!Object.getOwnPropertyDescriptors(this)[property]) {
|
|
Object.defineProperty(this, property, {
|
|
configurable: true,
|
|
enumerable: true,
|
|
get: () => this.#props[property],
|
|
set: (setValue) => {
|
|
this.#props[property] = setValue;
|
|
},
|
|
});
|
|
}
|
|
|
|
this.#props[property] = value;
|
|
}
|
|
|
|
static remove(property) {
|
|
delete this.#props[property];
|
|
}
|
|
}
|