{"id":16439156,"url":"https://github.com/posva/pinia-plugin-debounce","last_synced_at":"2025-04-04T17:06:39.384Z","repository":{"id":38331234,"uuid":"393372311","full_name":"posva/pinia-plugin-debounce","owner":"posva","description":"Config-based action debouncing made easy","archived":false,"fork":false,"pushed_at":"2024-10-21T03:58:48.000Z","size":838,"stargazers_count":66,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-21T06:56:43.567Z","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/posva.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/funding.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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},"funding":{"github":"posva"}},"created_at":"2021-08-06T12:37:02.000Z","updated_at":"2024-10-21T03:58:31.000Z","dependencies_parsed_at":"2024-03-04T05:29:49.387Z","dependency_job_id":"46c9e612-6bec-4125-b005-0f3888f8a9c5","html_url":"https://github.com/posva/pinia-plugin-debounce","commit_stats":{"total_commits":128,"total_committers":4,"mean_commits":32.0,"dds":0.5703125,"last_synced_commit":"6dda5e82ac054548f3b65106eef95306a9a47d11"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":"posva/lib-boilerplate-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posva%2Fpinia-plugin-debounce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posva%2Fpinia-plugin-debounce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posva%2Fpinia-plugin-debounce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posva%2Fpinia-plugin-debounce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posva","download_url":"https://codeload.github.com/posva/pinia-plugin-debounce/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247217176,"owners_count":20903009,"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-10-11T09:08:14.610Z","updated_at":"2025-04-04T17:06:39.364Z","avatar_url":"https://github.com/posva.png","language":"TypeScript","funding_links":["https://github.com/sponsors/posva"],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003e\n  \u003cimg height=\"64\" src=\"https://pinia.esm.dev/logo.svg\" alt=\"Pinia logo\"\u003e\n  Pinia Debounce\n\u003c/h1\u003e\n\n\u003ca href=\"https://npmjs.com/package/@pinia/plugin-debounce\"\u003e\n  \u003cimg src=\"https://badgen.net/npm/v/@pinia/plugin-debounce/latest\" alt=\"npm package\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/posva/pinia-plugin-debounce/actions/workflows/test.yml\"\u003e\n  \u003cimg src=\"https://github.com/posva/pinia-plugin-debounce/workflows/test/badge.svg\" alt=\"build status\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/posva/pinia-plugin-debounce\"\u003e\n  \u003cimg src=\"https://codecov.io/gh/posva/pinia-plugin-debounce/branch/main/graph/badge.svg?token=9WqnRrLf1Q\"/\u003e\n\u003c/a\u003e\n\nDebounce any action in your pinia 🍍 store!\n\nThis is also a very good example of **how to create a pinia plugin and how to type it**.\n\n## Installation\n\n```sh\nnpm install @pinia/plugin-debounce\n```\n\nYou also need to use a `debounce` function like [lodash.debounce](https://lodash.com/docs/4.17.15#debounce) or [ts-debounce](https://github.com/chodorowicz/ts-debounce)\n\n## Usage\n\n```js\nimport { debounce } from 'ts-debounce'\nimport { PiniaDebounce } from '@pinia/plugin-debounce'\n\n// Pass the plugin to your application's pinia plugin\npinia.use(PiniaDebounce(debounce))\n```\n\nYou can then use a `debounce` option in your stores:\n\n```js\ndefineStore('id', {\n  actions: {\n    someSearch() {\n      // ...\n    },\n    other() {\n      // ...\n    },\n  },\n  debounce: {\n    // debounce all `someSearch` calls by 300ms\n    someSearch: 300,\n    // you can pass an array of arguments if your debounce implementation accepts extra arguments\n    someSearch: [\n      300,\n      {\n        // options passed to debounce\n        isImmediate: true,\n      },\n    ],\n  },\n})\n```\n\nFor setup stores, options are in a second arugment:\n\n```js\ndefineStore(\n  'id',\n  () =\u003e {\n    // ...the store\n\n    return { someSearch }\n  },\n  {\n    debounce: {\n      // debounce all `someSearch` calls by 300ms\n      someSearch: 300,\n    },\n  }\n)\n```\n\n### Extended TypeScript support\n\nBy default, extra arguments passed to your `debounce` implementation are not typed. This can be changed by extending the `Config` interface in any of your ts files:\n\n```ts\nimport { debounce } from 'ts-debounce'\n\ndeclare module '@pinia/plugin-debounce' {\n  export interface Config {\n    Debounce: typeof debounce\n  }\n}\n```\n\n## License\n\n[MIT](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposva%2Fpinia-plugin-debounce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposva%2Fpinia-plugin-debounce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposva%2Fpinia-plugin-debounce/lists"}