{"id":20285801,"url":"https://github.com/tpkn/preference-manager","last_synced_at":"2025-06-23T02:09:17.538Z","repository":{"id":57329707,"uuid":"85417260","full_name":"tpkn/preference-manager","owner":"tpkn","description":"Save your Electron app setting to a local file","archived":false,"fork":false,"pushed_at":"2019-07-16T13:38:49.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-19T03:07:31.606Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/tpkn.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-03-18T16:53:03.000Z","updated_at":"2019-07-16T13:38:51.000Z","dependencies_parsed_at":"2022-09-10T10:36:39.594Z","dependency_job_id":null,"html_url":"https://github.com/tpkn/preference-manager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tpkn/preference-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpkn%2Fpreference-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpkn%2Fpreference-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpkn%2Fpreference-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpkn%2Fpreference-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tpkn","download_url":"https://codeload.github.com/tpkn/preference-manager/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpkn%2Fpreference-manager/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260899331,"owners_count":23079341,"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":[],"created_at":"2024-11-14T14:29:02.997Z","updated_at":"2025-06-23T02:09:12.523Z","avatar_url":"https://github.com/tpkn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Preference Manager [![npm Package](https://img.shields.io/npm/v/preference-manager.svg)](https://www.npmjs.org/package/preference-manager)\nSave your Electron app setting to a local file\n\nQuick save and load app window settings with a single line of code. Auto-remove empty settings and many more features. \nModule works both in main and render processes.\n\n\n## Installation\n```bash\nnpm install preference-manager\n```\n\n\n\n### Quick save window params `{x, y, width, height}`\n```javascript\nconst pm = require('preference-manager');\n\napp.on('ready', function(){\n   win.on('close', function(){\n      pm.quicksave();\n   });\n});\n```\n\n### Load and apply settings to the window\n```javascript\napp.on('ready', function(){\n   pm.quickload();\n});\n```\n\n\n### Save custom settings\n```javascript\npm.save({a: 1, b: 2, c: {d: 3}});\n```\n\n\n### Save settings and remove `empty` ones\n```javascript\npm.save({a: null, b: 2, c: {d: null}, d: new Date}, true);\n// =\u003e {b: 2, d: \"2011-02-15T11:22:40.263Z\"}\n```\n\n\n### Load\n```javascript\npm.load();\n// =\u003e {a: 1, b: 2, c: {d: 3}}\n```\n\n\n### Delete all\n```javascript\npm.flush();\n// =\u003e {}\n```\n\n\n### List all settings (with `beautify = true`)\n```javascript\npm.list(true);\n/*\n   { \n      a: 1, \n      b: 2, \n      c: {\n         d: 3\n      }\n   }\n*/\n```\n\n### Get settings file\n```javascript\npm.file;\n//=\u003e C:\\Users\\me\\AppData\\Roaming\\app\\.settings\n```\n\n\n## Changelog \n#### 2018-03-15:\n- v2.0.2 Now `quickload` method will never position your app outside the screen bounds (if, for example, you disabled the second monitor, where was your app on)\n\n#### 2018-03-04:\n- v2.0.1 Fixed bug, when app trying to save setting but app's `userData` folder does not exist yet\n\n#### 2018-02-13:\n- v2.0.0 Rewritten from ground up. Added few more stuff to manage your settings\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpkn%2Fpreference-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftpkn%2Fpreference-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpkn%2Fpreference-manager/lists"}