{"id":23366715,"url":"https://github.com/d8corp/watch-state-decorators","last_synced_at":"2025-04-07T23:15:46.278Z","repository":{"id":90515623,"uuid":"371936424","full_name":"d8corp/watch-state-decorators","owner":"d8corp","description":"Decorators to use watch-state","archived":false,"fork":false,"pushed_at":"2023-04-30T10:53:11.000Z","size":571,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T16:02:25.570Z","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/d8corp.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-29T09:52:06.000Z","updated_at":"2023-04-30T09:17:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"4700b314-2869-42dc-8d98-149b5c34cd82","html_url":"https://github.com/d8corp/watch-state-decorators","commit_stats":{"total_commits":26,"total_committers":1,"mean_commits":26.0,"dds":0.0,"last_synced_commit":"9a1142cf6b05c5ca2b3d7791fcf64a37f5b1e0ec"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Fwatch-state-decorators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Fwatch-state-decorators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Fwatch-state-decorators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Fwatch-state-decorators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d8corp","download_url":"https://codeload.github.com/d8corp/watch-state-decorators/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247744328,"owners_count":20988783,"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-12-21T14:17:23.946Z","updated_at":"2025-04-07T23:15:46.256Z","avatar_url":"https://github.com/d8corp.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://www.npmjs.com/package/watch-state\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/d8corp/watch-state/v3.3.1/img/logo.svg\" align=\"left\" width=\"90\" height=\"90\" alt=\"Watch-State logo by Mikhail Lysikov\"\u003e\n\u003c/a\u003e\n\n# \u0026nbsp; @watch-state/decorators\n\n\u0026nbsp;  \n[![NPM](https://img.shields.io/npm/v/@watch-state/decorators.svg)](https://www.npmjs.com/package/@watch-state/decorators)\n[![downloads](https://img.shields.io/npm/dm/@watch-state/decorators.svg)](https://www.npmtrends.com/@watch-state/decorators)\n[![downloads](https://img.shields.io/badge/Changelog-⋮-brightgreen)](https://changelogs.xyz/@watch-state/decorators)\n[![license](https://img.shields.io/npm/l/@watch-state/decorators)](https://github.com/d8corp/watch-state-decorators/blob/master/LICENSE)\n\nState management decorators based on [watch-state](https://www.npmjs.com/package/watch-state)\n\n### Install\nnpm\n```bash\nnpm i @watch-state/decorators\n```\nyarn\n```bash\nyarn add @watch-state/decorators\n```\n### Usage\nYou can use one of the next decorators\n```javascript\nimport { Watch } from 'watch-state'\nimport { state, cache, event } from '@watch-state/decorators'\n\nclass Counter {\n  // fields\n  @state accessor value = 1\n\n  // accessors\n  @cache get square () {\n    return this.value ** 2\n  }\n\n  // methods\n  @event tick () {\n    this.value++\n  }\n}\n\n\nconst counter = new Counter()\n\nnew Watch(() =\u003e console.log(counter.value, counter.square))\n// console.log(1, 1)\n\ncounter.tick()\n// console.log(2, 4)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd8corp%2Fwatch-state-decorators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd8corp%2Fwatch-state-decorators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd8corp%2Fwatch-state-decorators/lists"}