From 24f924e24eb3e10581e0d9216b0848420c84d59d Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 22 Aug 2019 00:21:53 +0400 Subject: Added 'LICENSE.txt' and 'README.md' files Signed-off-by: Valentin Popov --- README.md | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 946775a..2ded40d 100644 --- a/README.md +++ b/README.md @@ -1 +1,79 @@ # ElectronJS Reloader + +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-reloader + +# NPM +npm install --save electron-reloader +``` + +Next, you should create watchers: + +```javascript +import { mainReloader, rendererReloader } from 'electron-reloader'; +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 + +MIT License + +[MIT](LICENSE.txt). +Copyright (c) +[Valentin Popov](https://valentineus.link/). -- cgit v1.2.3 From 8147b911dec725f50fb79e22dd149e13eca02d81 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 22 Aug 2019 01:04:11 +0400 Subject: Updated a package's name Signed-off-by: Valentin Popov --- README.md | 8 ++++---- package.json | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 2ded40d..02c5ac7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ElectronJS Reloader +# ElectronJS Live Reload It is a simple method to restart your application. @@ -15,16 +15,16 @@ First, you should install this package: ```bash # Yarn -yarn add electron-reloader +yarn add electron-live-reload # NPM -npm install --save electron-reloader +npm install --save electron-live-reload ``` Next, you should create watchers: ```javascript -import { mainReloader, rendererReloader } from 'electron-reloader'; +import { mainReloader, rendererReloader } from 'electron-live-reload'; import { app } from 'electron'; import path from 'path'; diff --git a/package.json b/package.json index d7f242c..b2d2802 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "description": "It is a simple method to restart your application.", - "name": "electron-reloader", + "name": "electron-live-reload", "version": "0.1.0", "main": "dist/index.js", - "repository": "git@github.com:valentineus/ts-electron-reloader.git", + "repository": "git@github.com:valentineus/electron-live-reload.git", "author": { "email": "info@valentineus.link", "name": "Valentin Popov", @@ -15,10 +15,13 @@ "auto-reload", "auto-restart", "electron", + "live-reload", + "livereload", "node", "reload", "reloader", - "restart" + "restart", + "restarter" ], "scripts": { "build": "yarn run build:plugin", -- cgit v1.2.3