aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2019-08-22 00:12:17 +0300
committerGitHub <noreply@github.com>2019-08-22 00:12:17 +0300
commit6d5cb2611be73e4c3b0787ac00fe28e4c243417e (patch)
tree5b65999c40a916d0e4bb5f878b30cee236045e94 /README.md
parent03dd1ac6af558886acae1296832459827ade54c3 (diff)
parent8147b911dec725f50fb79e22dd149e13eca02d81 (diff)
downloadelectron-hot-reload-6d5cb2611be73e4c3b0787ac00fe28e4c243417e.tar.xz
electron-hot-reload-6d5cb2611be73e4c3b0787ac00fe28e4c243417e.zip
Merge pull request #1 from valentineus/develop
Develop
Diffstat (limited to 'README.md')
-rw-r--r--README.md80
1 files changed, 79 insertions, 1 deletions
diff --git a/README.md b/README.md
index 946775a..02c5ac7 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,79 @@
-# ElectronJS Reloader
+# ElectronJS Live Reload
+
+It is a simple method to restart your application.
+
+Features:
+
+- Separate watchers in main and renderer processes.
+- No magic, you necessary specify path files.
+- You can use hooks before reload.
+- Will catch error, if you want.
+
+## Example
+
+First, you should install this package:
+
+```bash
+# Yarn
+yarn add electron-live-reload
+
+# NPM
+npm install --save electron-live-reload
+```
+
+Next, you should create watchers:
+
+```javascript
+import { mainReloader, rendererReloader } from 'electron-live-reload';
+import { app } from 'electron';
+import path from 'path';
+
+const mainFile = path.join(app.getAppPath(), 'dist', 'main.js');
+const rendererFile = path.join(app.getAppPath(), 'dist', 'renderer.js');
+
+mainReloader(mainFile, undefined, (error, path) => {
+ console.log("It is a main's process hook!");
+});
+
+rendererReloader(rendererFile, undefined, (error, path) => {
+ console.log("It is a renderer's process hook!");
+});
+```
+
+[Do you want to example application?](example/application)
+
+## Documentation
+
+### mainReloader( paths, ignored, handler, options ) => void
+
+If this is method detects changes, it will restart the application.
+
+| Argument | Type | Requered | Description |
+| --------- | ---------------------- | -------- | --------------------------------------------- |
+| `paths` | `string` or `string[]` | `true` | Paths to files and dirs to recursively watch. |
+| `ignored` | `RegExp` or `RegExp[]` | `false` | RegExp to file or dirs to ignore. |
+| `handler` | `function` | `false` | Callback function to create hooks. |
+| `options` | `object` | `false` | Additional options to [chokidar]. |
+
+[chokidar]: https://github.com/paulmillr/chokidar/tree/a8f250e16cbef6d87d30639f3fce1299c46a40cd#persistence
+
+### rendererReloader( paths, ignored, handler, options ) => void
+
+If this is method detects changes, it will restart the application's windows.
+
+| Argument | Type | Requered | Description |
+| --------- | ---------------------- | -------- | --------------------------------------------- |
+| `paths` | `string` or `string[]` | `true` | Paths to files and dirs to recursively watch. |
+| `ignored` | `RegExp` or `RegExp[]` | `false` | RegExp to file or dirs to ignore. |
+| `handler` | `function` | `false` | Callback function to create hooks. |
+| `options` | `object` | `false` | Additional options to [chokidar]. |
+
+[chokidar]: https://github.com/paulmillr/chokidar/tree/a8f250e16cbef6d87d30639f3fce1299c46a40cd#persistence
+
+## License
+
+<img width="256px" alt="MIT License" src="https://raw.githubusercontent.com/valentineus/valentineus.github.io/master/assets/images/7d05cad0-d553-42c7-be1f-7007926ba720.png" />
+
+[MIT](LICENSE.txt).
+Copyright (c)
+[Valentin Popov](https://valentineus.link/).