16 lines
646 B
TypeScript
16 lines
646 B
TypeScript
export const Cfg = {
|
|
action: {} as Record<string, Function>,
|
|
addAction: function(name: string, callback: Function) {
|
|
this.action[name] = callback;
|
|
},
|
|
globalState: {} as Record<string, any>, // Global state definition
|
|
setGlobalState: function(key: string, value: any) { // Method to set global state
|
|
this.globalState[key] = value;
|
|
},
|
|
getGlobalState: function(key: string) { // Method to get global state
|
|
return this.globalState[key];
|
|
},
|
|
updateGlobalState: function(updates: Record<string, any>) { // Method to update global state
|
|
Object.assign(this.globalState, updates);
|
|
}
|
|
} |