-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtypes.ts
More file actions
57 lines (51 loc) · 1.03 KB
/
types.ts
File metadata and controls
57 lines (51 loc) · 1.03 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
56
57
import type { NMRiumData, NMRiumState } from 'nmrium';
interface BlobObject {
blob: Blob;
width: number;
height: number;
}
type EventType =
| 'load'
| 'data-change'
| 'error'
| 'action-request'
| 'action-response';
type LoadData =
| {
data: string[];
activeTab?: string;
type: 'url';
}
| {
data: File[];
activeTab?: string;
type: 'file';
}
| {
data: NMRiumData;
type: 'nmrium';
};
interface ActionRequest {
type: 'exportSpectraViewerAsBlob';
// params?: any;
}
interface ActionResponse {
type: 'exportSpectraViewerAsBlob';
data: BlobObject;
}
interface DataChange {
state: NMRiumState;
source: 'data' | 'view' | 'settings';
}
type EventData<T extends EventType> = T extends 'data-change'
? DataChange
: T extends 'load'
? LoadData
: T extends 'action-request'
? ActionRequest
: T extends 'action-response'
? ActionResponse
: T extends 'error'
? Error
: never;
export type { EventData, EventType };