How to pass parameters from main process to render processes in Electron

前端 未结 7 853
隐瞒了意图╮
隐瞒了意图╮ 2021-02-13 02:30

I have an Electron app that can open different windows.

On app launch the app open a set of window(s) (that load the same HTML and JS files) but with params to change ea

7条回答
  •  青春惊慌失措
    2021-02-13 02:42

    You can share data between main and renderer processor using global variable:

    Main processor:

    global.id = 1;
    

    Renderer processor:

    let id = remote.getGlobal('id');
    

提交回复
热议问题