@leafer/debug 1.0.0-beta.9 → 1.0.0-rc.2

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 CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@leafer/debug",
3
- "version": "1.0.0-beta.9",
3
+ "version": "1.0.0-rc.2",
4
4
  "description": "@leafer/debug",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
7
7
  "main": "src/index.ts",
8
+ "types": "types/index.d.ts",
8
9
  "files": [
9
- "src"
10
+ "src",
11
+ "types",
12
+ "dist"
10
13
  ],
11
14
  "repository": {
12
15
  "type": "git",
@@ -19,9 +22,9 @@
19
22
  "leaferjs"
20
23
  ],
21
24
  "dependencies": {
22
- "@leafer/math": "1.0.0-beta.9"
25
+ "@leafer/math": "1.0.0-rc.2"
23
26
  },
24
27
  "devDependencies": {
25
- "@leafer/interface": "1.0.0-beta.9"
28
+ "@leafer/interface": "1.0.0-rc.2"
26
29
  }
27
30
  }
package/src/Debug.ts CHANGED
@@ -46,12 +46,12 @@ export class Debug {
46
46
  }
47
47
 
48
48
  warn(...messages: unknown[]): void {
49
- console.warn(this.name, ...messages)
49
+ if (D.enable) console.warn(this.name, ...messages)
50
50
  }
51
51
 
52
52
  repeat(name: string, ...messages: unknown[]) {
53
53
  if (!this.repeatMap[name]) {
54
- console.warn(this.name, 'repeat:' + name, ...messages)
54
+ this.warn('repeat:' + name, ...messages)
55
55
  this.repeatMap[name] = true
56
56
  }
57
57
  }
@@ -0,0 +1,40 @@
1
+ import { IBooleanMap } from '@leafer/interface';
2
+
3
+ interface ids {
4
+ [name: string]: number;
5
+ }
6
+ interface names {
7
+ [name: string]: string;
8
+ }
9
+ declare class Run {
10
+ static currentId: number;
11
+ static currentTime: number;
12
+ static currentName: string;
13
+ static idMap: ids;
14
+ static nameMap: names;
15
+ static nameToIdMap: ids;
16
+ static start(name: string, microsecond?: boolean): number;
17
+ static end(id: number, microsecond?: boolean): void;
18
+ static endOfName(name: string, microsecond?: boolean): void;
19
+ }
20
+
21
+ declare class Debug {
22
+ static enable: boolean;
23
+ static filterList: string[];
24
+ static excludeList: string[];
25
+ static showRepaint: boolean;
26
+ static showHitView: boolean | string | string[];
27
+ static showBoundsView: boolean | string | string[];
28
+ name: string;
29
+ repeatMap: IBooleanMap;
30
+ constructor(name: string);
31
+ static get(name: string): Debug;
32
+ static set filter(name: string | string[]);
33
+ static set exclude(name: string | string[]);
34
+ log(...messages: unknown[]): void;
35
+ warn(...messages: unknown[]): void;
36
+ repeat(name: string, ...messages: unknown[]): void;
37
+ error(...messages: unknown[]): void;
38
+ }
39
+
40
+ export { Debug, Run };