{"id":14385142,"url":"https://github.com/istarkov/async-decorators","last_synced_at":"2025-06-24T07:08:18.527Z","repository":{"id":33082503,"uuid":"36719705","full_name":"istarkov/async-decorators","owner":"istarkov","description":"async-await and promise class methods decorators","archived":false,"fork":false,"pushed_at":"2015-10-30T17:22:18.000Z","size":144,"stargazers_count":44,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-04T22:32:11.090Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/istarkov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-02T08:38:13.000Z","updated_at":"2025-02-11T03:29:26.000Z","dependencies_parsed_at":"2022-09-06T04:02:10.460Z","dependency_job_id":null,"html_url":"https://github.com/istarkov/async-decorators","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/istarkov/async-decorators","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/istarkov%2Fasync-decorators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/istarkov%2Fasync-decorators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/istarkov%2Fasync-decorators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/istarkov%2Fasync-decorators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/istarkov","download_url":"https://codeload.github.com/istarkov/async-decorators/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/istarkov%2Fasync-decorators/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261624960,"owners_count":23186118,"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-08-28T18:01:59.106Z","updated_at":"2025-06-24T07:08:18.498Z","avatar_url":"https://github.com/istarkov.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"There are some helpfull decorators in this project for async class methods and functions.\n\n#Install\n\n```shell\nnpm install --save async-decorators\n```\n\n#Import\n\n```\nimport {memoize, serialize, isSkipError} from 'async-decorators';\n```\n\n#Memoize decorator   \nhas parameters `expireMs` and `cacheSize`   \nusage:   \n```javascript\nclass Action {\n  @memoize({expireMs: K_EXPIRE_MS, cacheSize: 256})\n  async query(p1, p2) {\n    return await getDataAsync({p1, p2});\n  }\n}\n```\n \nor just\n\n```javascript\nconst asyncFn = memoize(async (x) =\u003e {\n  return await ....\n});\n```\n\nSee [example source](https://github.com/istarkov/async-decorators/blob/master/examples/memoize.js)   \n```\nnpm run example_memoize\n```\nand [test source](https://github.com/istarkov/async-decorators/blob/master/__tests__/memoize.js)   \n```\nnpm run test_memoize\n```\n\n\n#Serialize decorator\nSerializes async method calls. (Make a new async call only if previous is completed)\nIf there are more than one pending async calls, skip all but the last.\n\nusage:   \n```javascript\nclass Action {\n  @serialize()\n  async query(p1, p2) {\n    return await getDataAsync({p1, p2});\n  }\n}\n```\n\nor just\n\n```javascript\nconst sfn = serialize(async (x) =\u003e {\n  return await ....\n})\n```\n\nSee [example source](https://github.com/istarkov/async-decorators/blob/master/examples/serialize.js)   \n```\nnpm run example_serialize\n```\n\n#Both decorator usage\n\n```javascript\nclass Action {\n  @serialize()\n  @memoize({expireMs: K_EXPIRE_MS})\n  async query(p1, p2) {\n    return await getDataAsync({p1, p2});\n  }\n}\n```\n\nSee [example source](https://github.com/istarkov/async-decorators/blob/master/examples/ser_memoize.js)   \n```\nnpm run example_ser_memoize\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fistarkov%2Fasync-decorators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fistarkov%2Fasync-decorators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fistarkov%2Fasync-decorators/lists"}