In my electron app, I have a simple node module, which is storing a simple object
petStore. This module exposes 2 methods:
getItemswhich return a Promise resolving with
- addItem(key, value)
which add a new entry to thepetStore` object
In my BrowserWindow, I am requiring this module, through the remote object, like this:
var store = require('electron').remote.require('./promise-store.js')
Then, on certain actions I am calling addItem, which is properly updating the
petStore object in the main process.
But then, when I am calling
getItems in my BrowserWindow, the promise is still resolving with the initial object values, like if nothing was added in the module.
Could someone explain me what’s the issue here ?
Here is the code, if my explanation lacks of clarity.