-
Notifications
You must be signed in to change notification settings - Fork 187
/
interfaces.ts
54 lines (48 loc) · 1.5 KB
/
interfaces.ts
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
import { Dict, SerializedTemplateWithLazyBlock } from '@glimmer/interfaces';
import { SimpleElement } from '@simple-dom/interface';
export type ComponentArgs = Readonly<Dict<any>>;
/**
* This abstracts a tracked root.
*/
export interface Cell<T> {
get(): T;
set(value: T): void;
}
export interface Benchmark {
/**
* Register a template only component
* @param name
* @param template
*/
templateOnlyComponent(name: string, template: SerializedTemplateWithLazyBlock): void;
/**
* Register a basic component
* @param name
* @param template
* @param component
*/
basicComponent<TComponent extends object = object>(
name: string,
template: SerializedTemplateWithLazyBlock,
component: new (args: ComponentArgs) => TComponent
): void;
/**
* Create the benchmark
* @param entry the name of the entry component
* @param args the named args to the component
* @param element the target element to append to
* @param isInteractive whether we are in SSR mode
*/
render(
entry: string,
args: Dict<unknown>,
element: SimpleElement | HTMLElement,
isInteractive?: boolean
): Promise<UpdateBenchmark>;
}
/**
* Update the benchmark.
* @param name - the name of the measure. The marks used will be `${measure}Start` and `${measure}End`.
* @param doUpdate - a callback that will do the mutation, the measure will be from before the callback until it is rendered.
*/
export type UpdateBenchmark = (name: string, doUpdate: () => void) => Promise<void>;