{"id":26481929,"url":"https://github.com/electron-utils/electron-window-plus","last_synced_at":"2025-07-09T08:04:54.308Z","repository":{"id":57221979,"uuid":"82465441","full_name":"electron-utils/electron-window-plus","owner":"electron-utils","description":"Save and restore window states.","archived":false,"fork":false,"pushed_at":"2018-03-21T09:23:11.000Z","size":42,"stargazers_count":9,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-06T04:37:52.356Z","etag":null,"topics":["electron","window","window-manager"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/electron-utils.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-19T14:38:00.000Z","updated_at":"2021-07-22T20:33:41.000Z","dependencies_parsed_at":"2022-08-31T08:50:23.301Z","dependency_job_id":null,"html_url":"https://github.com/electron-utils/electron-window-plus","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/electron-utils/electron-window-plus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron-utils%2Felectron-window-plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron-utils%2Felectron-window-plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron-utils%2Felectron-window-plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron-utils%2Felectron-window-plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/electron-utils","download_url":"https://codeload.github.com/electron-utils/electron-window-plus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron-utils%2Felectron-window-plus/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264379205,"owners_count":23598823,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["electron","window","window-manager"],"created_at":"2025-03-20T03:36:18.515Z","updated_at":"2025-07-09T08:04:54.072Z","avatar_url":"https://github.com/electron-utils.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# electron-window-plus\n\n[![Linux Build Status](https://travis-ci.org/electron-utils/electron-window-plus.svg?branch=master)](https://travis-ci.org/electron-utils/electron-window-plus)\n[![Windows Build status](https://ci.appveyor.com/api/projects/status/7cf5xyawomjy3na2?svg=true)](https://ci.appveyor.com/project/jwu/electron-window-plus)\n[![Dependency Status](https://david-dm.org/electron-utils/electron-window-plus.svg)](https://david-dm.org/electron-utils/electron-window-plus)\n[![devDependency Status](https://david-dm.org/electron-utils/electron-window-plus/dev-status.svg)](https://david-dm.org/electron-utils/electron-window-plus#info=devDependencies)\n\nSave and restore window states.\n\n**TODO**\n\n  - [ ] Add tests for _mainWindowFailed: windowPlus.loadURL failed and did-fail-load.\n  - [ ] Add tests for userdata update \u0026 restore.\n  - [ ] Add test for main window url different to default. \n  - [ ] Add tests for windowPlus.restore().\n  - [ ] Add other tests...\n\n## Why this module?\n\nThere are several great module such as [electron-window-state](https://github.com/mawie81/electron-window-state), [electron-window-manager](https://github.com/TamkeenLMS/electron-window-manager)\nthat doing the same thing. What is the advantage of this module compare to them?\n\n  - Support save and restore multiple windows.\n  - Did not introduce new Window class for management.\n  - Try to recover to default when restore failed.\n\n## Install\n\n```bash\nnpm install --save electron-window-plus\n```\n\n## Run Examples:\n\n```bash\nnpm start examples/${name}\n```\n\n## Usage\n\n```javascript\nconst {app, BrowserWindow} = require('electron');\nconst windowPlus = require('electron-window-plus');\n\napp.on('ready', function () {\n  if ( !windowPlus.restore() ) {\n    let win = new BrowserWindow({\n      width: 300,\n      height: 300,\n    });\n\n    windowPlus.manage(win);\n    windowPlus.loadURL(win, `file://${__dirname}/index.html`);\n  }\n});\n```\n\n## API Reference\n\n### Methods\n\n### windowPlus.restore ([defaultUrl, opts])\n\n  - `defaultUrl` string\n  - `opts` options\n\n### windowPlus.manage (win[, uuid, userdata])\n\n  - `win` BrowserWindow\n  - `uuid` string\n  - `userdata` object\n\n### windowPlus.unmanage (win)\n\n  - `win` BrowserWindow|number\n\n### windowPlus.getUserData (win)\n\n  - `win` BrowserWindow|number\n\n### windowPlus.updateUserData (win, userdata)\n\n  - `win` BrowserWindow|number\n  - `userdata` object\n\n### windowPlus.save ()\n\n### windowPlus.loadURL (win, url, argv)\n\n  - `win` BrowserWindow\n  - `string` url\n  - `object` argv\n\n### windowPlus.adjust (win, x, y, w, h)\n  - `win` BrowserWindow\n  - `x` number\n  - `y` number\n  - `w` number\n  - `h` number\n\nTry to adjust the window to fit the position and size we give\n\n### windowPlus.adjustToMain (win)\n\n  - `win` BrowserWindow\n\nAdjust window position to make it open in the same display screen as main window\n\n### windowPlus.on (eventName, listener)\n\n  - `eventName` string\n  - `listener` function\n\nAdds an event listener function.\n\n### windowPlus.off (eventName, listener)\n\n  - `eventName` string\n  - `listener` function\n\nRemoves an event listener function.\n\n### windowPlus.once (eventName, listener)\n\n  - `eventName` string\n  - `listener` function\n\nAdds a one time event listener function.\n\n### Properties\n\n### windowPlus.main\n\nThe main window.\n\n### Events\n\n### 'manage'\n\nEmit when window get managed via `windowPlus.manage()`.\n\n### 'unmanage'\n\nEmit when window unmanaged via `windowPlus.unmanage()`.\n\n### 'save'\n\nEmit when window profile saved.\n\n### 'main-window-failed'\n\nEmit when main window loading failed.\n\n## License\n\nMIT © 2017 Johnny Wu\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectron-utils%2Felectron-window-plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felectron-utils%2Felectron-window-plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectron-utils%2Felectron-window-plus/lists"}