@leafer/debug
Advanced tools
+3
-3
| { | ||
| "name": "@leafer/debug", | ||
| "version": "1.2.2", | ||
| "version": "1.3.0", | ||
| "description": "@leafer/debug", | ||
@@ -25,7 +25,7 @@ "author": "Chao (Leafer) Wan", | ||
| "dependencies": { | ||
| "@leafer/math": "1.2.2" | ||
| "@leafer/math": "1.3.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@leafer/interface": "1.2.2" | ||
| "@leafer/interface": "1.3.0" | ||
| } | ||
| } |
+13
-5
@@ -0,10 +1,16 @@ | ||
| import { IBooleanMap } from '@leafer/interface' | ||
| const check = [] as string[] | ||
| export const Plugin = { | ||
| list: {} as any, | ||
| list: {} as IBooleanMap, | ||
| add(name: string) { | ||
| add(name: string, ...needPlugins: string[]) { | ||
| this.list[name] = true | ||
| check.push(...needPlugins) | ||
| }, | ||
| check(name: string, tip?: boolean): boolean { | ||
| has(name: string, tip?: boolean): boolean { | ||
| const rs = this.list[name] | ||
@@ -16,5 +22,7 @@ if (!rs && tip) this.need(name) | ||
| need(name: string): any { | ||
| console.error('need plugin: @leafer-in/' + name) | ||
| console.error('need plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name) | ||
| } | ||
| } | ||
| } | ||
| setTimeout(() => check.forEach(name => Plugin.has(name, true))) |
+3
-3
@@ -42,5 +42,5 @@ import { IBooleanMap } from '@leafer/interface'; | ||
| declare const Plugin: { | ||
| list: any; | ||
| add(name: string): void; | ||
| check(name: string, tip?: boolean): boolean; | ||
| list: IBooleanMap; | ||
| add(name: string, ...needPlugins: string[]): void; | ||
| has(name: string, tip?: boolean): boolean; | ||
| need(name: string): any; | ||
@@ -47,0 +47,0 @@ }; |
6783
4.27%153
2.68%+ Added
- Removed
Updated