{"id":15434299,"url":"https://github.com/cenfun/async-tick","last_synced_at":"2025-03-14T14:15:04.556Z","repository":{"id":148844924,"uuid":"620885853","full_name":"cenfun/async-tick","owner":"cenfun","description":"async-tick","archived":false,"fork":false,"pushed_at":"2023-04-07T06:09:53.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-04T09:18:21.536Z","etag":null,"topics":["async","debounce","microtask","throttle","tick"],"latest_commit_sha":null,"homepage":"https://cenfun.github.io/async-tick/","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/cenfun.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":"2023-03-29T15:03:00.000Z","updated_at":"2024-03-23T09:42:40.000Z","dependencies_parsed_at":"2023-07-08T03:46:34.832Z","dependency_job_id":null,"html_url":"https://github.com/cenfun/async-tick","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cenfun%2Fasync-tick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cenfun%2Fasync-tick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cenfun%2Fasync-tick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cenfun%2Fasync-tick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cenfun","download_url":"https://codeload.github.com/cenfun/async-tick/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243589328,"owners_count":20315471,"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":["async","debounce","microtask","throttle","tick"],"created_at":"2024-10-01T18:38:42.041Z","updated_at":"2025-03-14T14:15:04.454Z","avatar_url":"https://github.com/cenfun.png","language":"JavaScript","readme":"# async-tick\n\n## Preview\n[https://cenfun.github.io/async-tick/](https://cenfun.github.io/async-tick/)\n\n## Install\n```\nnpm i async-tick\n```\n## microtask\n```js\nimport { microtask } from \"async-tick\";\n\nconst microtaskCallback = microtask((arg) =\u003e {\n    console.log(arg);\n});\n\nmicrotaskCallback(1);\n```\n### microtask VS nextTick\n- microtask can be canceled\n```js\nmicrotaskCallback(1);\nmicrotaskCallback.cancel();\n// will not output 1\n```\n- microtask no repeated calls, only using the most recent callback in an event loop\n```js\nmicrotaskCallback(1);\nmicrotaskCallback(2);\n// will only output 2\n```\n\n## throttle\n```js\nimport { throttle } from \"async-tick\";\n\nconst throttleCallback = throttle((arg) =\u003e {\n    console.log(arg);\n}, 100);\n\nthrottleCallback(1);\n```\n\n## debounce\n```js\nimport { debounce } from \"async-tick\";\n\nconst debounceCallback = debounce((arg) =\u003e {\n    console.log(arg);\n}, 100);\n\ndebounceCallback(1);\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcenfun%2Fasync-tick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcenfun%2Fasync-tick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcenfun%2Fasync-tick/lists"}