const Store = require('electron-store') | |
const store = new Store() | |
function createWindow () { | |
const win = new BrowserWindow({ | |
width: store.get('width',800), // 永続化されていたらその値を、されていなければデフォルト値 | |
height: store.get('height',600), // 永続化されていたらその値を、されていなければデフォルト値 | |
center: true, | |
resizable: true, | |
webPreferences: { | |
nodeIntegration: true, | |
enableRemoteModule: true, // 永続化 | |
} | |
}) | |
win.on('close',()=> { | |
store.set('width', win.getSize()[0]) // widthを永続化 | |
store.set('height', win.getSize()[1]) // heightを永続化 | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment