Skip to content

Commit 8dd370b

Browse files
authored
Add hostname option (#35)
1 parent ffd5acb commit 8dd370b

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

index.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ declare namespace electronServe {
1515
*/
1616
scheme?: string;
1717

18+
/**
19+
Custom hostname.
20+
21+
@default '-'
22+
*/
23+
hostname?: string;
24+
1825
/**
1926
Whether [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) should be enabled.
2027
Useful for testing purposes.

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ const getPath = async path_ => {
2626
module.exports = options => {
2727
options = Object.assign({
2828
isCorsEnabled: true,
29-
scheme: 'app'
29+
scheme: 'app',
30+
hostname: '-'
3031
}, options);
3132

3233
if (!options.directory) {
@@ -72,6 +73,6 @@ module.exports = options => {
7273
});
7374

7475
return async window_ => {
75-
await window_.loadURL(`${options.scheme}://-`);
76+
await window_.loadURL(`${options.scheme}://${options.hostname}`);
7677
};
7778
};

readme.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ Default: `'app'`
5757

5858
Custom scheme. For example, `foo` results in your `directory` being available at `foo://-`.
5959

60+
##### hostname
61+
62+
Type: `string`\
63+
Default: `'-'`
64+
65+
Custom hostname.
66+
6067
##### isCorsEnabled
6168

6269
Type: `boolean`\

0 commit comments

Comments
 (0)