-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathindex.d.ts
More file actions
55 lines (51 loc) · 1.97 KB
/
index.d.ts
File metadata and controls
55 lines (51 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import Benchmark from 'benchmark'
import EventEmitter from 'events'
export interface Log {
type: string
text: string
}
export interface RunOptions {
/**
* Run a development build instead of a production build to aid debugging.
* @default false
*/
debug?: boolean
/**
* Run Chrome in windowed mode with the devtools open.
* @default false
*/
devtools?: boolean
/**
* Run Chrome with CPU throttled X times. Useful to receive more precise results between runs.
* @default 1
*/
cpuThrottle?: number
/**
* If `true` RAM measurement is enabled. In this case, 2 metrics are being recorded between the runs:
* - Heap size (`JSHeapUsedSize`) represents how much RAM was consumed at the end of a test iteration.
* - `Object.prototype` represents how many objects were created in RAM at the end of a test iteration.
* @default false
*/
isRamMeasured?: boolean
}
export default class ReactBenchmark extends EventEmitter {
/**
* Starts the benchmark.
* @param filepath Path to the benchmark file to run.
* @param options Optional object containing additional options.
* @returns A Promise that will resolve to a [Benchmark](https://benchmarkjs.com/docs) object containing the stats once the benchmark has been completed.
*/
run(filepath: string, options?: RunOptions): Promise<Benchmark>
/** Fired when the Webpack build has started. */
on(event: 'webpack', callback: () => void): void
/** Fired when the webserver has started. */
on(event: 'server', callback: () => void): void
/** Fired when Chrome has launched. */
on(event: 'chrome', callback: () => void): void
/** Fired when the actual benchmark starts. */
on(event: 'start', callback: () => void): void
/** Fired every time a benchmark cycle has been completed. */
on(event: 'progress', callback: (benchmark: Benchmark) => void): void
/** Fired every time something is logged to Chrome՚s console. */
on(event: 'console', callback: (log: Log) => void): void
}