forked from fonsp/Pluto.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDesktop.d.ts
55 lines (53 loc) · 2.03 KB
/
Desktop.d.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
55
declare global {
/**
* This namespace is meant for [PlutoDesktop](https://github.com/JuliaPluto/PlutoDesktop)
* related types and interfaces.
*/
namespace Desktop {
/**
* This enum has to be in sync with the enum "PlutoExport"
* defined in PlutoDesktop/{branch:master}/types/enums.ts
*
* @note Unfortunately enums can't be exported from .d.ts files.
* Inorder to use this, just map integers to the enum values
* - PlutoExport.FILE -> **0**
* - PlutoExport.HTML -> **1**
* - PlutoExport.STATE -> **2**
* - PlutoExport.PDF -> **3**
*/
enum PlutoExport {
FILE,
HTML,
STATE,
PDF,
}
/**
* This type has to be in sync with the interface "Window"
* defined in PlutoDesktop/{branch:master}/src/renderer/preload.d.ts
*/
type PlutoDesktop = {
ipcRenderer: {
sendMessage(channel: String, args: unknown[]): void
on(channel: string, func: (...args: unknown[]) => void): (() => void) | undefined
once(channel: string, func: (...args: unknown[]) => void): void
}
fileSystem: {
/**
* @param type [default = 'new'] whether you want to open a new notebook
* open a notebook from a path or from a url
* @param pathOrURL location to the file, not needed if opening a new file,
* opens that notebook. If false and no path is there, opens the file selector.
* If true, opens a new blank notebook.
*/
openNotebook(type?: "url" | "path" | "new", pathOrURL?: string): void
shutdownNotebook(id?: string): void
moveNotebook(id?: string): void
exportNotebook(id: string, type: PlutoExport): void
}
}
}
interface Window {
plutoDesktop?: Desktop.PlutoDesktop
}
}
export {}