electron-webpack icon indicating copy to clipboard operation
electron-webpack copied to clipboard

multiple renderer windows

Open farfromrefug opened this issue 7 years ago • 6 comments

Hi,

My app have multiple renderer windows with different html/js files. All inside the renderer folder. How can i add multiple entries for them?

farfromrefug avatar Apr 30 '18 14:04 farfromrefug

You need a router. Basically each window will load the same html file, but you'll put a ?route=*** query parameter or something to instruct the renderer on which page/component it should actually load.

fabiospampinato avatar Dec 07 '18 00:12 fabiospampinato

I've published this very simple router for solving the problem: https://www.npmjs.com/package/react-router-static, just add a ?route=*** parameter to the url and you're set.

fabiospampinato avatar Jan 20 '19 20:01 fabiospampinato

@fabiospampinato my project does not use React, how to achieve the same without it?

febox6 avatar Feb 27 '20 12:02 febox6

@febox6 the question is so general that I'd answer it with: learn to program.

fabiospampinato avatar Feb 27 '20 13:02 fabiospampinato

Ok, thanks anyway, from your answer I got that the router solution is not react exclusive.

febox6 avatar Feb 27 '20 14:02 febox6

@febox6 yeah "routing" just means taking a different path depending on whatever. No matter the UI framework you're using you can always do this:

  • From the main process tell the renderer process which route/path to take, in my example above I'm doing that my setting a url parameter called "route".
  • Then from the renderer process you read that parameter and do something different (in this case load the UI for a different window) depending on what it says.

fabiospampinato avatar Feb 27 '20 14:02 fabiospampinato