forked from sindresorhus/electron-serve
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.d.ts
More file actions
63 lines (48 loc) · 1.25 KB
/
index.d.ts
File metadata and controls
63 lines (48 loc) · 1.25 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
58
59
60
61
62
63
/// <reference lib="dom"/>
/// <reference types="electron"/>
/// <reference types="node"/>
import {BrowserWindow} from 'electron';
declare namespace electronServe {
interface Options {
/**
The directory to serve, relative to the app root directory.
*/
directory: string;
/**
Custom scheme. For example, `foo` results in your `directory` being available at `foo://-`.
@default 'app'
*/
scheme?: string;
/**
The partition the protocol should be installed to, if you're not using Electron's default partition.
@default electron.session.defaultSession
*/
partition?:string
}
interface loadURL {
/**
Load the index file in the window.
*/
(window: BrowserWindow): Promise<void>;
}
}
/**
Static file serving for Electron apps.
@example
```
import {app, BrowserWindow} from 'electron';
import serve = require('electron-serve');
const loadURL = serve({directory: 'renderer'});
let mainWindow;
(async () => {
await app.whenReady();
mainWindow = new BrowserWindow();
await loadURL(mainWindow);
// The above is equivalent to this:
await mainWindow.loadURL('app://-');
// The `-` is just the required hostname.
})();
```
*/
declare function electronServe(options: electronServe.Options): electronServe.loadURL;
export = electronServe;