{"id":15374640,"url":"https://github.com/nktnet1/slync","last_synced_at":"2026-01-03T10:09:32.073Z","repository":{"id":203672187,"uuid":"710166990","full_name":"nktnet1/slync","owner":"nktnet1","description":"Dependency-less event-loop blocking sleep modelled after atomic-sleep","archived":false,"fork":false,"pushed_at":"2024-07-18T00:43:41.000Z","size":1712,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-06T03:36:24.960Z","etag":null,"topics":["atomic","atomic-sleep","blocking","event","loop","nodejs","sleep","sync","synchronous","wait"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/slync","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/nktnet1.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-10-26T06:44:51.000Z","updated_at":"2024-09-14T08:19:33.000Z","dependencies_parsed_at":"2024-06-22T00:02:07.341Z","dependency_job_id":"6b4e0805-f546-4808-b7f4-37a824672bf6","html_url":"https://github.com/nktnet1/slync","commit_stats":null,"previous_names":["nktnet1/slync"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nktnet1%2Fslync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nktnet1%2Fslync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nktnet1%2Fslync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nktnet1%2Fslync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nktnet1","download_url":"https://codeload.github.com/nktnet1/slync/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243847056,"owners_count":20357317,"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":["atomic","atomic-sleep","blocking","event","loop","nodejs","sleep","sync","synchronous","wait"],"created_at":"2024-10-01T13:59:14.253Z","updated_at":"2026-01-03T10:09:32.018Z","avatar_url":"https://github.com/nktnet1.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# [![Slync](logo.svg)](https://github.com/nktnet1/slync)\n\n[![pipeline](https://github.com/nktnet1/slync/actions/workflows/pipeline.yml/badge.svg)](https://github.com/nktnet1/slync/actions/workflows/pipeline.yml)\n\u0026nbsp;\n[![codecov](https://codecov.io/gh/nktnet1/slync/branch/main/graph/badge.svg?token=RAC7SKJTGU)](https://codecov.io/gh/nktnet1/slync)\n\u0026nbsp;\n[![Maintainability](https://api.codeclimate.com/v1/badges/1ae83ff4c0c0c8fc4a17/maintainability)](https://codeclimate.com/github/nktnet1/slync/maintainability)\n\u0026nbsp;\n[![Snyk Security](https://snyk.io/test/github/nktnet1/slync/badge.svg)](https://snyk.io/test/github/nktnet1/slync)\n\u0026nbsp;\n[![GitHub top language](https://img.shields.io/github/languages/top/nktnet1/slync)](https://github.com/search?q=repo%3Anktnet1%2Fslync++language%3ATypeScript\u0026type=code)\n\n[![NPM Version](https://img.shields.io/npm/v/slync?logo=npm)](https://www.npmjs.com/package/slync?activeTab=versions)\n\u0026nbsp;\n[![install size](https://packagephobia.com/badge?p=slync)](https://packagephobia.com/result?p=slync)\n\u0026nbsp;\n[![Depfu Dependencies](https://badges.depfu.com/badges/6c4074c4d23ad57ee2bfd9ff90456090/overview.svg)](https://depfu.com/github/nktnet1/slync?project_id=39032)\n\u0026nbsp;\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fnktnet1%2Fslync.svg?type=shield\u0026issueType=license)](https://app.fossa.com/projects/git%2Bgithub.com%2Fnktnet1%2Fslync?ref=badge_shield\u0026issueType=license)\n\u0026nbsp;\n[![NPM License](https://img.shields.io/npm/l/slync)](https://opensource.org/license/mit/)\n\u0026nbsp;\n[![GitHub issues](https://img.shields.io/github/issues/nktnet1/slync.svg?style=social)](https://github.com/nktnet1/slync/issues)\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nktnet1_slync\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=nktnet1_slync)\n\u0026nbsp;\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/af0385991c474ca692e8c7f85321e26a)](https://app.codacy.com/gh/nktnet1/slync/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n\u0026nbsp;\n[![DeepSource](https://app.deepsource.com/gh/nktnet1/slync.svg/?label=active+issues\u0026show_trend=true\u0026token=r1frerF1-N2Mhrc7ZXIC1uNa)](https://app.deepsource.com/gh/nktnet1/slync/)\n\u0026nbsp;\n[![codebeat badge](https://codebeat.co/badges/5f4be12d-b0fd-4aab-92e9-5d70999ee489)](https://codebeat.co/projects/github-com-nktnet1-slync-main)\n\u0026nbsp;\n[![GitHub stars](https://img.shields.io/github/stars/nktnet1/slync.svg?style=social)](https://github.com/nktnet1/slync/stargazers)\n\n[![Downloads Total](https://badgen.net/npm/dt/slync)](https://moiva.io/?npm=slync)\n\u0026nbsp;\n[![Downloads Yearly](https://badgen.net/npm/dy/slync)](https://moiva.io/?npm=slync)\n\u0026nbsp;\n[![Downloads Monthly](https://badgen.net/npm/dm/slync)](https://moiva.io/?npm=slync)\n\u0026nbsp;\n[![Downloads Weekly](https://badgen.net/npm/dw/slync)](https://moiva.io/?npm=slync)\n\u0026nbsp;\n[![Downloads Daily](https://badgen.net/npm/dd/slync)](https://moiva.io/?npm=slync) \n\n---\n\n0 dependencies event-loop blocking synchronous sleep\n\nsleep + sync = slync\n\nmodelled after [atomic-sleep](https://github.com/davidmarkclements/atomic-sleep)\n\n[![Try with Replit](https://replit.com/badge?caption=Try%20with%20Replit)](https://replit.com/@nktnet1/slync-example#index.js)\n\n\u003c/div\u003e\n\n---\n\n- [1. Installation](#1-installation)\n- [2. Usage](#2-usage)\n- [3. License](#3-license)\n- [4. Limitations](#4-limitations)\n- [5. Caveats](#5-caveats)\n\n## 1. Installation\n\n```\nnpm install slync\n```\n\n## 2. Usage\n\nTry with [Replit](https://replit.com/@nktnet1/slync-example#index.js).\n\n```javascript\nslync(ms) // where ms is the number of milliseconds\n```\n\nExample usage of synchronously sleeping for 2 seconds:\n```javascript\n// import slync from 'slync';\nconst slync = require('slync');\n\nconsole.log(`0. Current time: ${new Date()}`);\n\nsetTimeout(() =\u003e {\n  console.log(`2. Prints second because slync blocks: ${new Date()}`);\n}, 100);\n\nslync(2000);\n\nconsole.log(`1. Prints first after 2000 milliseconds: ${new Date()}`);\n```\n\n\n## 3. License\n\n\u003cdetails closed\u003e\n\u003csummary\u003e\n  Massachusetts Institute of Technology\n  (\u003ca href=\"https://opensource.org/license/mit\" target=\"_blank\"\u003eMIT\u003c/a\u003e)\n\u003c/summary\u003e\n\n\u003cbr/\u003e\n\n```\nCopyright (c) 2023 Khiet Tam Nguyen\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the “Software”),\nto deal in the Software without restriction, including without limitation\nthe rights to use, copy, modify, merge, publish, distribute, sublicense,\nand/or sell copies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\nTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\nDEALINGS IN THE SOFTWARE.\n```\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fnktnet1%2Fslync.svg?type=large\u0026issueType=license)](https://app.fossa.com/projects/git%2Bgithub.com%2Fnktnet1%2Fslync?ref=badge_large\u0026issueType=license)\n\n\u003c/details\u003e\n\n## 4. Limitations\n\nThere are currently no known limitations.\n\n## 5. Caveats\n\n**slync** is modelled after [atomic-sleep](https://github.com/davidmarkclements/atomic-sleep), with some minor differences:\n- **slync** is written in [TypeScript](https://www.typescriptlang.org)\n- **slync** only accepts 'number' for the ms parameter whereas [atomic-sleep](https://github.com/davidmarkclements/atomic-sleep) also accepts 'bigint'\n- **slync** will determine which sleep method to use (atomic vs naive) at runtime\n\nFor synchronous non-blocking sleep, look into [deasync](https://github.com/abbr/deasync).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnktnet1%2Fslync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnktnet1%2Fslync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnktnet1%2Fslync/lists"}