@leafer/debug 1.0.0-alpha.23 → 1.0.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/Debug.ts +9 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/debug",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.30",
|
|
4
4
|
"description": "@leafer/debug",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"leaferjs"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@leafer/math": "1.0.0-alpha.
|
|
22
|
+
"@leafer/math": "1.0.0-alpha.30"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@leafer/interface": "1.0.0-alpha.
|
|
25
|
+
"@leafer/interface": "1.0.0-alpha.30"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/src/Debug.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { IObject } from '@leafer/interface'
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
export class Debug {
|
|
5
2
|
|
|
6
3
|
static enable: boolean
|
|
@@ -9,11 +6,9 @@ export class Debug {
|
|
|
9
6
|
static excludeList: string[] = []
|
|
10
7
|
|
|
11
8
|
// other
|
|
12
|
-
static __: IObject = {}
|
|
13
|
-
|
|
14
9
|
static showRepaint: boolean
|
|
15
|
-
|
|
16
|
-
static
|
|
10
|
+
static showHitView: boolean | string | string[]
|
|
11
|
+
static showBoundsView: boolean | string | string[]
|
|
17
12
|
|
|
18
13
|
public name: string
|
|
19
14
|
|
|
@@ -37,6 +32,7 @@ export class Debug {
|
|
|
37
32
|
this.excludeList = name
|
|
38
33
|
}
|
|
39
34
|
|
|
35
|
+
|
|
40
36
|
log(...messages: unknown[]): void {
|
|
41
37
|
if (D.enable) {
|
|
42
38
|
if (D.filterList.length && D.filterList.every(name => name !== this.name)) return
|
|
@@ -50,20 +46,12 @@ export class Debug {
|
|
|
50
46
|
}
|
|
51
47
|
|
|
52
48
|
error(...messages: unknown[]): void {
|
|
53
|
-
|
|
49
|
+
try {
|
|
50
|
+
throw new Error()
|
|
51
|
+
} catch (e) {
|
|
52
|
+
console.error(this.name, ...messages, e)
|
|
53
|
+
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
const D = Debug
|
|
58
|
-
|
|
59
|
-
// function debugAttr(defaultValue?: unknown) {
|
|
60
|
-
// return (target: IObject, key: string) => {
|
|
61
|
-
// Object.defineProperty(target, key, {
|
|
62
|
-
// get() { return target.enable ? target.__[key] : defaultValue },
|
|
63
|
-
// set(value: unknown) {
|
|
64
|
-
// if (value) target.enable = true
|
|
65
|
-
// this.__[key] = value
|
|
66
|
-
// }
|
|
67
|
-
// })
|
|
68
|
-
// }
|
|
69
|
-
// }
|
|
57
|
+
const D = Debug
|