{"_id":"@bytehive/electron-window-state","_rev":"3-1dda66108b204d6636d1967ba02ce477","name":"@bytehive/electron-window-state","dist-tags":{"latest":"5.0.6"},"versions":{"5.0.3":{"name":"@bytehive/electron-window-state","version":"5.0.3","description":"Simple module that helps to save and restore size and position of Electron windows.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/mawie81/electron-window-state.git"},"main":"index.js","author":{"name":"Marcel Wiehle"},"engines":{"node":">=8.0.0"},"scripts":{"test":"xo && ava"},"keywords":["electron"],"dependencies":{"jsonfile":"^4.0.0","mkdirp":"^0.5.1"},"devDependencies":{"ava":"^0.25.0","mockery":"^2.1.0","sinon":"^6.1.5","xo":"^0.22.0"},"xo":{"space":true,"ignores":["index.d.ts"],"rules":{"brace-style":[2,"1tbs",{"allowSingleLine":true}],"prefer-object-spread":0}},"types":"./index.d.ts","gitHead":"2701d9a0f90a44dc8dbf81430538ceb16c9ff27a","bugs":{"url":"https://github.com/mawie81/electron-window-state/issues"},"homepage":"https://github.com/mawie81/electron-window-state#readme","_id":"@bytehive/electron-window-state@5.0.3","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-oegV4trbpwSfa59teUqZmO7OdufWgcwZeAhe59uHWobQR9GI0UtCykLdy/9kc/fSqpKqcQkTCFUlVxqocw/OSA==","shasum":"7518d9caa50b8c014726fe3121ec4fea75321438","tarball":"https://registry.npmjs.org/@bytehive/electron-window-state/-/electron-window-state-5.0.3.tgz","fileCount":5,"unpackedSize":13793,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCy+wPB6PGIPRB3Y2wCPGOGRjueiASi9hoTUip8zwSZigIgfKBlY3VbIt3gAtNJ285QO8AbmOhXnGirFzJJtghtYoI="}]},"_npmUser":{"name":"snrse","email":"jonas@bytehive.de"},"directories":{},"maintainers":[{"name":"snrse","email":"jonas@bytehive.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/electron-window-state_5.0.3_1689596500091_0.3811800143327042"},"_hasShrinkwrap":false},"5.0.4":{"name":"@bytehive/electron-window-state","version":"5.0.4","description":"Simple module that helps to save and restore size and position of Electron windows. with a little taste of Bytehive","license":"MIT","repository":{"type":"git","url":"git+https://github.com/bytehive/electron-window-state.git"},"main":"index.js","author":{"name":"Jonas Dautel"},"engines":{"node":">=8.0.0"},"scripts":{"test":"xo && ava"},"keywords":["electron"],"dependencies":{"jsonfile":"^4.0.0","mkdirp":"^0.5.1"},"devDependencies":{"ava":"^0.25.0","mockery":"^2.1.0","sinon":"^6.1.5","xo":"^0.22.0"},"xo":{"space":true,"ignores":["index.d.ts"],"rules":{"brace-style":[2,"1tbs",{"allowSingleLine":true}],"prefer-object-spread":0}},"types":"./index.d.ts","gitHead":"2701d9a0f90a44dc8dbf81430538ceb16c9ff27a","bugs":{"url":"https://github.com/bytehive/electron-window-state/issues"},"homepage":"https://github.com/bytehive/electron-window-state#readme","_id":"@bytehive/electron-window-state@5.0.4","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-ve3IsWAGYkMR6qB5DVonWfNSJjodkqoI64Fkx5wyOir5/PzoubEFMzvtWVs4zZ6zwk8Duw+plX86OBHi12Z2AA==","shasum":"2dd1dca05b13d2fa50c8ed9ae9c9e563ceab9307","tarball":"https://registry.npmjs.org/@bytehive/electron-window-state/-/electron-window-state-5.0.4.tgz","fileCount":5,"unpackedSize":14023,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCjEcYOdued4dvhmOMAnTyiRkCmLoPrzYqDkgtlJnyGXwIgNc6NALNZqYcA3WISPu4nriopQuXYgclPTLH/eeQtm3Q="}]},"_npmUser":{"name":"snrse","email":"jonas@bytehive.de"},"directories":{},"maintainers":[{"name":"snrse","email":"jonas@bytehive.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/electron-window-state_5.0.4_1689597568427_0.22871627114234316"},"_hasShrinkwrap":false},"5.0.5":{"name":"@bytehive/electron-window-state","version":"5.0.5","description":"Simple module that helps to save and restore size and position of Electron windows. with a little taste of Bytehive","license":"MIT","repository":{"type":"git","url":"git+https://github.com/bytehive/electron-window-state.git"},"main":"index.js","author":{"name":"Jonas Dautel"},"engines":{"node":">=8.0.0"},"scripts":{"test":"xo && ava"},"keywords":["electron"],"dependencies":{"jsonfile":"^4.0.0","mkdirp":"^0.5.1"},"devDependencies":{"ava":"^0.25.0","mockery":"^2.1.0","sinon":"^6.1.5","xo":"^0.22.0"},"xo":{"space":true,"ignores":["index.d.ts"],"rules":{"brace-style":[2,"1tbs",{"allowSingleLine":true}],"prefer-object-spread":0}},"types":"./index.d.ts","gitHead":"2701d9a0f90a44dc8dbf81430538ceb16c9ff27a","bugs":{"url":"https://github.com/bytehive/electron-window-state/issues"},"homepage":"https://github.com/bytehive/electron-window-state#readme","_id":"@bytehive/electron-window-state@5.0.5","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-4kgjqYw1ZOy4q8yni5DSuxQ2JHKnOPZqHUgi5toLG9BY+qQHEcPL0z+IpXEmSmZ1cCYK+XKQ5yxnPLNRlW8VNA==","shasum":"f6b85ac1469d205eacbf9f595e26899c3a94b1bd","tarball":"https://registry.npmjs.org/@bytehive/electron-window-state/-/electron-window-state-5.0.5.tgz","fileCount":5,"unpackedSize":13922,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHKfjDteazwihJA3IjVoMp51rQG2bJNaAF1IEp/MUR6EAiEAijp2P5f6ZUHJ9b8Cce+NMNwzSBHjagaFyVDBPvQopSo="}]},"_npmUser":{"name":"snrse","email":"jonas@bytehive.de"},"directories":{},"maintainers":[{"name":"snrse","email":"jonas@bytehive.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/electron-window-state_5.0.5_1689597646827_0.4992286666132877"},"_hasShrinkwrap":false},"5.0.6":{"name":"@bytehive/electron-window-state","version":"5.0.6","description":"Simple module that helps to save and restore size and position of Electron windows. with a little taste of Bytehive","license":"MIT","repository":{"type":"git","url":"git+https://github.com/bytehive/electron-window-state.git"},"main":"index.js","author":{"name":"Jonas Dautel"},"engines":{"node":">=8.0.0"},"scripts":{"test":"xo && ava"},"keywords":["electron"],"dependencies":{"jsonfile":"^4.0.0","mkdirp":"^0.5.1"},"devDependencies":{"ava":"^0.25.0","mockery":"^2.1.0","sinon":"^6.1.5","xo":"^0.22.0"},"xo":{"space":true,"ignores":["index.d.ts"],"rules":{"brace-style":[2,"1tbs",{"allowSingleLine":true}],"prefer-object-spread":0}},"types":"./index.d.ts","gitHead":"2701d9a0f90a44dc8dbf81430538ceb16c9ff27a","bugs":{"url":"https://github.com/bytehive/electron-window-state/issues"},"homepage":"https://github.com/bytehive/electron-window-state#readme","_id":"@bytehive/electron-window-state@5.0.6","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-knUc8SuTB306iDSLE5emw2yWQG5bBgCKJ9OhilvdYqkX+D0G48AjqcOzBSpXLYSvyTizM7TLHiaSFtxEVzkhQA==","shasum":"bc3f51054992ed670cbbea131c6bff586cb74564","tarball":"https://registry.npmjs.org/@bytehive/electron-window-state/-/electron-window-state-5.0.6.tgz","fileCount":5,"unpackedSize":13926,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDpNwHbnLONEN+jRFDXPrkHEkWNCkGoxYRA/yj+eZ63MgIhAJPzs/LRu5scBdp2Jp0xfwxAijmfBEeNP82eoDEYN0M8"}]},"_npmUser":{"name":"snrse","email":"jonas@bytehive.de"},"directories":{},"maintainers":[{"name":"snrse","email":"jonas@bytehive.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/electron-window-state_5.0.6_1689599761708_0.738511895337508"},"_hasShrinkwrap":false}},"time":{"created":"2023-07-17T12:21:39.935Z","5.0.3":"2023-07-17T12:21:40.277Z","modified":"2023-07-17T13:16:02.096Z","5.0.4":"2023-07-17T12:39:28.563Z","5.0.5":"2023-07-17T12:40:46.976Z","5.0.6":"2023-07-17T13:16:01.916Z"},"maintainers":[{"name":"snrse","email":"jonas@bytehive.de"}],"description":"Simple module that helps to save and restore size and position of Electron windows. with a little taste of Bytehive","homepage":"https://github.com/bytehive/electron-window-state#readme","keywords":["electron"],"repository":{"type":"git","url":"git+https://github.com/bytehive/electron-window-state.git"},"author":{"name":"Jonas Dautel"},"bugs":{"url":"https://github.com/bytehive/electron-window-state/issues"},"license":"MIT","readme":"> A library to store and restore window sizes and positions for your\r\n[Electron](http://electron.atom.io) app, now also allows you to store Frame info\r\n\r\n*Heavily influenced by the implementation in [electron-boilerplate](https://github.com/szwacz/electron-boilerplate).*\r\n\r\n## Install\r\n\r\n```\r\n$ npm install --save @bytehive/electron-window-state\r\n```\r\n\r\n## Usage\r\n\r\n```js\r\nconst windowStateKeeper = require('electron-window-state');\r\nlet win;\r\n\r\napp.on('ready', function () {\r\n  // Load the previous state with fallback to defaults\r\n  let mainWindowState = windowStateKeeper({\r\n    defaultWidth: 1000,\r\n    defaultHeight: 800\r\n  });\r\n\r\n  // Create the window using the state information\r\n  win = new BrowserWindow({\r\n    'x': mainWindowState.x,\r\n    'y': mainWindowState.y,\r\n    'width': mainWindowState.width,\r\n    'height': mainWindowState.height\r\n  });\r\n\r\n  // Let us register listeners on the window, so we can update the state\r\n  // automatically (the listeners will be removed when the window is closed)\r\n  // and restore the maximized or full screen state\r\n  mainWindowState.manage(win);\r\n});\r\n```\r\n\r\nPlease do not set `useContentSize` to `true` at creating `BrowserWindow` instance\r\nbecause it changes how to calculate window size.\r\n\r\n## API\r\n\r\n#### windowStateKeeper(opts)\r\n\r\nNote: Don't call this function before the `ready` event is fired.\r\n\r\n##### opts\r\n\r\n`defaultWidth` - *Number*\r\n\r\n  The width that should be returned if no file exists yet. Defaults to `800`.\r\n\r\n`defaultHeight` - *Number*\r\n\r\n  The height that should be returned if no file exists yet. Defaults to `600`.\r\n\r\n`path` - *String*\r\n\r\n  The path where the state file should be written to. Defaults to\r\n  `app.getPath('userData')`\r\n\r\n`file` - *String*\r\n\r\n  The name of file. Defaults to `window-state.json`. This is usefull if you want to support multiple windows. Simply create multiple ```windowStateKeeper``` instances with different filenames.\r\n\r\n`maximize` - *Boolean*\r\n\r\n  Should we automatically maximize the window, if it was last closed\r\n  maximized. Defaults to `true`\r\n\r\n`fullScreen` - *Boolean*\r\n\r\n  Should we automatically restore the window to full screen, if it was last\r\n  closed full screen. Defaults to `true`\r\n\r\n### state object\r\n\r\n```js\r\nconst windowState = windowStateKeeper({\r\n  defaultWidth: 1000,\r\n  defaultHeight: 800\r\n});\r\n```\r\n\r\n`x` - *Number*\r\n\r\n  The saved `x` coordinate of the loaded state. `undefined` if the state has not\r\n  been saved yet.\r\n\r\n`y` - *Number*\r\n\r\n  The saved `y` coordinate of the loaded state. `undefined` if the state has not\r\n  been saved yet.\r\n\r\n`width` - *Number*\r\n\r\n  The saved `width` of loaded state. `defaultWidth` if the state has not been\r\n  saved yet.\r\n\r\n`height` - *Number*\r\n\r\n  The saved `heigth` of loaded state. `defaultHeight` if the state has not been\r\n  saved yet.\r\n\r\n`isMaximized` - *Boolean*\r\n\r\n  `true` if the window state was saved while the window was maximized.\r\n  `undefined` if the state has not been saved yet.\r\n\r\n`isFullScreen` - *Boolean*\r\n\r\n  `true` if the window state was saved while the window was in full screen\r\n  mode. `undefined` if the state has not been saved yet.\r\n\r\n`manage(window)` - *Function*\r\n\r\n  Register listeners on the given `BrowserWindow` for events that are\r\n  related to size or position changes (`resize`, `move`). It will also restore\r\n  the window's maximized or full screen state.\r\n  When the window is closed we automatically remove the listeners and save the\r\n  state.\r\n\r\n`unmanage` - *Function*\r\n\r\n  Removes all listeners of the managed `BrowserWindow` in case it does not\r\n  need to be managed anymore.\r\n\r\n`saveState(window)` - *Function*\r\n\r\n  Saves the current state of the given `BrowserWindow`. This exists mostly for\r\n  legacy purposes, and in most cases it's better to just use `manage`.\r\n\r\n## License\r\nForked from [Marcel Wiehle](http://marcel.wiehle.me)\r\n","readmeFilename":"readme.md"}