You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use electron-store (v10.0.0) in this template and tried several ways to initialize the store in the main process to then access it in the renderer.
My latest approach, which at least in my head seems to be the right way of doing it, is as follows:
// packages/main/src/mainWindow.tsimportStorefrom'electron-store';// ...asyncfunctioncreateWindow(){constbrowserWindow=newBrowserWindow({show: false,// Use the 'ready-to-show' event to show the instantiated BrowserWindow.webPreferences: {nodeIntegration: false,contextIsolation: true,sandbox: false,// Sandbox disabled because the demo of preload script depend on the Node.js apiwebviewTag: false,// The webview tag is not recommended. Consider alternatives like an iframe or Electron's BrowserView. @see https://www.electronjs.org/docs/latest/api/webview-tag#warningpreload: join(app.getAppPath(),'packages/preload/dist/index.mjs'),},});// ...Store.initRenderer();// ...}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to use
electron-store
(v10.0.0) in this template and tried several ways to initialize the store in the main process to then access it in the renderer.My latest approach, which at least in my head seems to be the right way of doing it, is as follows:
Unfortunately there's no other error in the console where I'm running
npm run watch
.I'd be thankful for any ideas. Thank you in advance! :)
Beta Was this translation helpful? Give feedback.
All reactions