{"id":30181000,"url":"https://github.com/streamich/current-tick","last_synced_at":"2025-08-12T08:06:59.505Z","repository":{"id":33712024,"uuid":"160928734","full_name":"streamich/current-tick","owner":"streamich","description":"Enqueue function to execute later within current event loop cycle","archived":false,"fork":false,"pushed_at":"2023-12-15T08:47:19.000Z","size":2156,"stargazers_count":4,"open_issues_count":22,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-22T15:55:18.362Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/streamich.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}},"created_at":"2018-12-08T10:34:46.000Z","updated_at":"2020-04-15T03:51:08.000Z","dependencies_parsed_at":"2024-02-05T10:14:43.210Z","dependency_job_id":null,"html_url":"https://github.com/streamich/current-tick","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/streamich/current-tick","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fcurrent-tick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fcurrent-tick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fcurrent-tick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fcurrent-tick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streamich","download_url":"https://codeload.github.com/streamich/current-tick/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fcurrent-tick/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270024697,"owners_count":24514054,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2025-08-12T08:06:27.315Z","updated_at":"2025-08-12T08:06:59.496Z","avatar_url":"https://github.com/streamich.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# current-tick\n\nA tiny modern no-nonsense \"current-tick\" implementation that equeues your function to be executed\nlater __within the current event loop cycle__, exactly what unfortunately named\n[`process.nextTick`](https://nodejs.org/api/process.html#process_process_nexttick_callback_args) does in Node.js,\nbut `current-tick` also works in the browser.\n\nIt will try below methods in the following order:\n\n1. `process.nextTick`\n2. `Promise`\n3. `MutationObserver`\n4. `WebkitMutationObserver`\n\n`current-tick` will be equal to `null` if your evironment does not support any of the above methods.\n\n```js\nimport currentTick from 'current-tick';\n\nif (!currentTick) {\n  console.log('Your environment is not supported!');\n}\n\ncurrentTick(() =\u003e console.log('world!'));\nconsole.log('Hello');\n// 👉 Hello world!\n```\n\nIf you use TypeScript, because `currentTick` may be `null`, if you know for sure your evironment supports\nat least one of the methods, you can use `!` to tell the TypeScript compiler that `currentTick` is not `null`.\n\n```ts\ncurrentTick!(fn);\n```\n\nAlternatively, you can define an `asap` method, that will 100% always exist, but\n__will not guarantee that your function is always executed within the current event loop cycle__.\n\n```js\nconst asap = currentTick ||\n  typeof setImmediate === 'function'\n    ? setImmediate\n    : fn =\u003e setTimeout(fn, 0);\n```\n\n`asap` function is already prepared for you:\n\n```js\nimport asap from 'current-tick/lib/asap';\n\nasap(() =\u003e console.log('world!'));\nconsole.log('Hello');\n// 👉 Hello world!\n```\n\n## License\n\n[Unlicense](LICENSE) \u0026mdash; public domain.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamich%2Fcurrent-tick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreamich%2Fcurrent-tick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamich%2Fcurrent-tick/lists"}