diff options
Diffstat (limited to 'features/soopyGui/categoryManager.js')
-rw-r--r-- | features/soopyGui/categoryManager.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/features/soopyGui/categoryManager.js b/features/soopyGui/categoryManager.js new file mode 100644 index 0000000..6709ff4 --- /dev/null +++ b/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 |