Giter Site home page Giter Site logo

electroscope's Introduction

electroscope

painless reload for electron main process

Let the electroscope check the modules according to the entry file you give, and if necessary, refresh the main process and do not touch the renderer! Also, may the stdio be with you.

Installation

npm install --dev electroscope

yarn add --dev electroscope

Of course you can use electroscope as global module.

Usage

1) Replace the existing calls to electroscope in scripts.

/* package.json */

"scripts": {
-   "start": "electron main.js",
+   "start": "electroscope main.js"
}

2) Require module in entry file of electron

const foo = require('bar')
...

if(process.env.NODE_ENV === 'development') {
	require('electroscope')
}

Why this module?

I've tried all the other electron-reload stuffs, but there are a few things they all missed. First, the app.relaunch method doesn't work as we expected, at least it wasn't what we imagined in our minds. app.relaunch caused us to lose control of stdio, and we had to do little hacking to partially solve it. I do not like it :/ Secondly, why changes in my rendering process cause an update to main process? Maybe I want to use HMR? Booom! The only change is that it updates both my main process and my renderer process. Okay, it might be a good idea to split the renderer and main files into different folders or use a regex pattern, but I'm too lazy to do that.

License

MIT © kubilay salih

electroscope's People

Contributors

kubilaysalih avatar

Stargazers

Damla Ehican avatar İbrahim AKSÜT avatar Yasin Solak avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.