@playcanvas/inspector 0.4.0 → 0.6.0

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.
@@ -0,0 +1,104 @@
1
+ /**
2
+ * A message logged by the page.
3
+ */
4
+ export type LogEntry = object;
5
+ /**
6
+ * A message logged by the page.
7
+ *
8
+ * @typedef {object} LogEntry
9
+ * @ignore
10
+ * @property {number} seq - Its number: later messages have higher numbers.
11
+ * @property {number} time - When it was logged, in milliseconds since the capture started; for a
12
+ * repeated message, when it was last logged.
13
+ * @property {number} frame - The app frame it was logged in, or last logged in.
14
+ * @property {string} level - 'error', 'warn', 'info', 'log' or 'debug'.
15
+ * @property {string} text - The message.
16
+ * @property {number} count - How many times in a row it was logged.
17
+ * @property {string} [stack] - Where an uncaught error was thrown.
18
+ */
19
+ export const LEVELS: string[];
20
+ /**
21
+ * Keeps the messages the page logs to the console, and the errors nothing caught, while started:
22
+ * the engine's warnings and errors in a debug build, shader compile errors, and the app's own
23
+ * messages. The console methods are wrapped while it runs, and still log as before; the console
24
+ * then names the wrapper as where a message came from, which is why it only runs while asked.
25
+ *
26
+ * @ignore
27
+ */
28
+ export class LogCapture {
29
+ /**
30
+ * @param {() => number} frame - The app frame now.
31
+ */
32
+ constructor(frame: () => number);
33
+ /**
34
+ * The messages kept, oldest first.
35
+ *
36
+ * @type {LogEntry[]}
37
+ */
38
+ entries: LogEntry[];
39
+ /**
40
+ * The number of the last message.
41
+ *
42
+ * @type {number}
43
+ */
44
+ seq: number;
45
+ /**
46
+ * @type {() => number}
47
+ * @private
48
+ */
49
+ private _frame;
50
+ /**
51
+ * The console methods replaced, by level, while started.
52
+ *
53
+ * @type {Map<string, Function>|null}
54
+ * @private
55
+ */
56
+ private _originals;
57
+ /**
58
+ * @type {Map<string, Function>}
59
+ * @private
60
+ */
61
+ private _wrappers;
62
+ /**
63
+ * @type {number}
64
+ * @private
65
+ */
66
+ private _start;
67
+ /**
68
+ * Whether messages are being kept.
69
+ *
70
+ * @type {boolean}
71
+ */
72
+ get capturing(): boolean;
73
+ /**
74
+ * Starts keeping messages.
75
+ */
76
+ start(): void;
77
+ /**
78
+ * Stops keeping messages, and puts the console back. A console method something else replaced
79
+ * after the capture started is left as it is.
80
+ */
81
+ stop(): void;
82
+ /**
83
+ * Keeps a message. A message logged again right after itself counts up rather than repeating.
84
+ *
85
+ * @param {string} level - Its level.
86
+ * @param {string} text - The message.
87
+ * @param {string} [stack] - Where it was thrown.
88
+ */
89
+ add(level: string, text: string, stack?: string): void;
90
+ /**
91
+ * Forgets every message kept.
92
+ */
93
+ clear(): void;
94
+ /**
95
+ * @param {ErrorEvent} e - An error nothing caught.
96
+ * @private
97
+ */
98
+ private _onError;
99
+ /**
100
+ * @param {PromiseRejectionEvent} e - A rejection nothing handled.
101
+ * @private
102
+ */
103
+ private _onRejection;
104
+ }