sort/components/html/action.tsx

16 lines
646 B
TypeScript
Raw Normal View History

2024-09-07 01:22:11 +00:00
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);
}
}