reactor: move electron-store to samples folder
This commit is contained in:
parent
cb5f5b8af8
commit
9ad3bfd152
|
@ -1,7 +1,7 @@
|
||||||
import os from 'os'
|
import os from 'os'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { app, BrowserWindow, ipcMain } from 'electron'
|
import { app, BrowserWindow } from 'electron'
|
||||||
import Store from 'electron-store'
|
import './samples/electron-store'
|
||||||
|
|
||||||
const isWin7 = os.release().startsWith('6.1')
|
const isWin7 = os.release().startsWith('6.1')
|
||||||
if (isWin7) app.disableHardwareAcceleration()
|
if (isWin7) app.disableHardwareAcceleration()
|
||||||
|
@ -54,16 +54,3 @@ app.on('second-instance', () => {
|
||||||
win.focus()
|
win.focus()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// -------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Expose 'electron-store' to renderer through 'ipcMain.handle'
|
|
||||||
*/
|
|
||||||
const store = new Store
|
|
||||||
ipcMain.handle('electron-store', async (_evnet, methodSign: string, ...args: any[]) => {
|
|
||||||
if (typeof (store as any)[methodSign] === 'function') {
|
|
||||||
return (store as any)[methodSign](...args)
|
|
||||||
}
|
|
||||||
return (store as any)[methodSign]
|
|
||||||
})
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
/**
|
||||||
|
* Use 'electron-store' sample code.
|
||||||
|
*/
|
||||||
|
import { ipcMain } from 'electron'
|
||||||
|
import Store from 'electron-store'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expose 'electron-store' to Renderer-process through 'ipcMain.handle'
|
||||||
|
*/
|
||||||
|
const store = new Store
|
||||||
|
ipcMain.handle('electron-store', async (_evnet, methodSign: string, ...args: any[]) => {
|
||||||
|
if (typeof (store as any)[methodSign] === 'function') {
|
||||||
|
return (store as any)[methodSign](...args)
|
||||||
|
}
|
||||||
|
return (store as any)[methodSign]
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in New Issue