{"id":15785809,"url":"https://github.com/js2me/storage-sync-accessor-decorator","last_synced_at":"2026-02-24T08:34:25.521Z","repository":{"id":249243703,"uuid":"830908488","full_name":"js2me/storage-sync-accessor-decorator","owner":"js2me","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-30T19:27:31.000Z","size":100,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-30T04:46:07.675Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/js2me.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-19T08:53:01.000Z","updated_at":"2024-12-30T19:27:30.000Z","dependencies_parsed_at":"2024-07-19T15:38:40.905Z","dependency_job_id":"ece96e7c-0e01-40b9-b5cd-f78b0d41be78","html_url":"https://github.com/js2me/storage-sync-accessor-decorator","commit_stats":null,"previous_names":["js2me/storage-sync-accessor-decorator"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/js2me/storage-sync-accessor-decorator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js2me%2Fstorage-sync-accessor-decorator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js2me%2Fstorage-sync-accessor-decorator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js2me%2Fstorage-sync-accessor-decorator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js2me%2Fstorage-sync-accessor-decorator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/js2me","download_url":"https://codeload.github.com/js2me/storage-sync-accessor-decorator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js2me%2Fstorage-sync-accessor-decorator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29776642,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T04:54:30.205Z","status":"ssl_error","status_checked_at":"2026-02-24T04:53:58.628Z","response_time":75,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-10-04T20:41:34.282Z","updated_at":"2026-02-24T08:34:25.503Z","avatar_url":"https://github.com/js2me.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm](https://img.shields.io/npm/v/storage-sync-accessor-decorator)](https://www.npmjs.com/package/storage-sync-accessor-decorator) \n[![license](https://img.shields.io/npm/l/storage-sync-accessor-decorator)](https://github.com/js2me/storage-sync-accessor-decorator/blob/master/LICENSE)  \n\n# storage-sync-accessor-decorator  \n\nWorks only for property assignment cases  \n\n## Usage  \n\n```ts\nimport { observable } from \"mobx\";\nimport { createStorageSyncDecorator } from \"storage-sync-accessor-decorator\";\n\nconst storageSync = createStorageSyncDecorator({\n  get: ({ key, fallback }) =\u003e {\n    return JSON.parse(localStorage.getItem(key) || '')\n  },\n  set: ({ key,value }) =\u003e {\n    localStorage.setItem(key, JSON.stringify(value))\n  }\n})\n\n\nclass SomeModel {\n  @storageSync({ key: 'foo', fallback: 10 })\n  accessor foo!: number;\n\n  @storageSync({ fallback: 10 }) // key will be 'bar'\n  accessor bar!: number\n\n  @storageSync({ fallback: '100' })\n  @observable\n  accessor baz!: number\n}\n```\n\n## other cases   \n\n```ts\n\nimport { createStorage, GetFromStorageConfig } from 'yammies/storage';\n\nexport const storage = createStorage({\n  prefix: 'my-prefix',\n});\n\n\ninterface StorageSyncDecoratorConfig\u003cT\u003e\n  extends Omit\u003cGetFromStorageConfig\u003cT\u003e, 'key' | 'prefix'\u003e {\n  /**\n   * Ключ хранилища, если не указан, то будет использовано имя свойства\n   */\n  key?: GetFromStorageConfig\u003cT\u003e['key'];\n}\n\nexport const storageSync = createStorageSyncDecorator\u003c\n  StorageSyncDecoratorConfig\u003cany\u003e\n\u003e({\n  get: storage.get,\n  set: storage.set,\n});\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjs2me%2Fstorage-sync-accessor-decorator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjs2me%2Fstorage-sync-accessor-decorator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjs2me%2Fstorage-sync-accessor-decorator/lists"}