Shared node context between multiple windows / iframes

Is it possible to share a node-context between multiple windows or at least between a window and its iframes? This would make sharing data a lot easier.

node-webkit does this by default, unless you use the new-instance parameter on

Is something similar possible here? Does that require having the windows/iframes in the same process?

Thanks a lot!

4 thoughts on “Shared node context between multiple windows / iframes

  1. There is no shared context in atom-shell, if you want to share an object between windows you can store the object in browser process and use remote module to access it in renderer:

    // In main.js of browser process
    global.sharedObject = {};
    // js in 1.html
    require('remote').getGlobal('sharedObject').someProperty = 'some value';
    // js in 2.html

    You can also use localStorage to store shared data.

  2. Happened upon this page and it seems the API suggested above has changed. It’s now:

    require('electron').remote.getGlobal('sharedObject').someProperty = 'new value'

  3. It’s worth noting, that while this works for simple objects, it’s useless for things like MediaStreams. I have a case where I need to display media streams originating in another window in child windows. For this reason alone, I’ve been forced to use NW.js