-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
- Loading branch information
1 parent
a92dc36
commit 559dbd3
Showing
3 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/// <reference types="node"/> | ||
|
||
declare namespace electronReloader { | ||
interface Options { | ||
/** | ||
Watch files used in the renderer process and reload the window when they change. | ||
@default true | ||
*/ | ||
readonly watchRenderer?: boolean; | ||
|
||
/** | ||
Prints watched paths and when files change. Can be useful to make sure you set it up correctly. | ||
@default false | ||
*/ | ||
readonly debug?: boolean; | ||
|
||
/** | ||
Ignore patterns passed to [`chokidar`](https://github.com/paulmillr/chokidar#path-filtering). | ||
By default, files/directories starting with a `.`, `.map` files, and `node_modules` directories are ignored. This option is additive to those. | ||
*/ | ||
readonly ignore?: readonly (string | RegExp)[]; | ||
} | ||
} | ||
|
||
/** | ||
@param moduleObject - Global `module` object. | ||
@example | ||
``` | ||
import electronReloader = require('electron-reloader'); | ||
try { | ||
require('electron-reloader')(module); | ||
} catch {} | ||
``` | ||
*/ | ||
declare function electronReloader( | ||
moduleObject: NodeModule, | ||
options?: electronReloader.Options | ||
): void; | ||
|
||
export = electronReloader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import {expectType} from 'tsd'; | ||
import electronReloader = require('.'); | ||
|
||
expectType<void>(electronReloader(module)); | ||
expectType<void>(electronReloader(module, {watchRenderer: true})); | ||
expectType<void>(electronReloader(module, {debug: true, ignore: ['tmp', /dist/]})); | ||
expectType<void>(electronReloader(module, {watchRenderer: true, ignore: ['tmp', /dist/]})); | ||
expectType<void>(electronReloader(module, {watchRenderer: true, debug: true, ignore: ['tmp', /dist/]})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters