aboutsummaryrefslogtreecommitdiff
path: root/src/features/soopyGui/categoryManager.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/features/soopyGui/categoryManager.js')
-rw-r--r--src/features/soopyGui/categoryManager.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/features/soopyGui/categoryManager.js b/src/features/soopyGui/categoryManager.js
new file mode 100644
index 0000000..6709ff4
--- /dev/null
+++ b/src/features/soopyGui/categoryManager.js
@@ -0,0 +1,37 @@
+class CategoryManager {
+ constructor(){
+ this.categorys = {}
+
+ this.arr = []
+ }
+
+ addCategory(category){
+ // this.pages = this.pages.filter(a=>a.name!==category.name)
+
+ this.categorys[category.name] = (category)
+ this.update()
+ }
+
+ deleteCategory(category){
+ delete this.categorys[category.name]
+ this.update()
+ }
+
+ update(){
+
+ this.arr = Object.values(this.categorys).sort((a, b)=>{
+ return b.priority - a.priority
+ })
+ }
+}
+
+
+if(!global.soopyv2CategoryManager){
+ global.soopyv2CategoryManager = new CategoryManager()
+
+ register("gameUnload", ()=>{
+ global.soopyv2CategoryManager = undefined
+ })
+}
+
+export default global.soopyv2CategoryManager \ No newline at end of file