{"id":27103322,"url":"https://github.com/sasuw/sleep-please","last_synced_at":"2025-10-20T10:52:48.360Z","repository":{"id":60629932,"uuid":"544359284","full_name":"sasuw/sleep-please","owner":"sasuw","description":"Sleeps in Node.js","archived":false,"fork":false,"pushed_at":"2022-10-02T15:21:01.000Z","size":21085,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-08T22:51:27.749Z","etag":null,"topics":["nodejs","npm-package","pause","sleep","wait"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/sleep-please","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sasuw.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}},"created_at":"2022-10-02T09:23:48.000Z","updated_at":"2022-10-02T11:06:35.000Z","dependencies_parsed_at":"2023-01-19T02:15:22.211Z","dependency_job_id":null,"html_url":"https://github.com/sasuw/sleep-please","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasuw%2Fsleep-please","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasuw%2Fsleep-please/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasuw%2Fsleep-please/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasuw%2Fsleep-please/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sasuw","download_url":"https://codeload.github.com/sasuw/sleep-please/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247517943,"owners_count":20951718,"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":["nodejs","npm-package","pause","sleep","wait"],"created_at":"2025-04-06T16:52:54.345Z","updated_at":"2025-10-20T10:52:48.352Z","avatar_url":"https://github.com/sasuw.png","language":"TypeScript","readme":"# sleep-please\n\nPauses execution for a specified duration. \n\nYou may ask: why? It's so trivial to implement yourself. Well, it's shorter to type `await Sleep.sleep(1000)` than \n`await new Promise(resolve =\u003e setTimeout(resolve, 1000));`. In the heat of the moment of debugging I don't want to\nlose my flow by wasting seconds doing something trivial. Besides that, this project was an opportunity to \nto implement a NodeJS project working with both CommonJS and ESM support.\n\n## What's with the name?\n\nI like anagrams and it's almost a [phonetic](https://en.wikipedia.org/wiki/International_Phonetic_Alphabet) [anagram](https://en.wikipedia.org/wiki/Anagram).\n\nsleep: `/sliːp/`  \nplease: `/pliːz/`\n\n## Contents\n\n[Features](#features)  \n[Installing](#installing)  \n[Usage examples](#usage-examples)  \n[API Documentation](#api-documentation)  \n[Compatibility](#compatibility)  \n[Performance](#performance)  \n[License](#license)  \n[Contributing](#contributing)  \n\n\n## Features\n\n* CommonJS and ESM support\n* Zero dependencies\n* TypeScript types included\n* Abort signal support\n\n## Installing\n\n```\nnpm install sleep-please\n```\n\n## Usage examples\n\n### Including `sleep-please`\n\n#### CommonJS\n\n```typescript\nconst Sleep = require('sleep-please').default;\n```\n\n#### ESM\n\n```typescript\nimport Sleep from 'sleep-please';\n```\n\n### Basic sleep\n\n```typescript\nimport Sleep from 'sleep-please';\n\n// Basic usage\nawait Sleep.sleep(2000); // Pause for 2 seconds\n\n// Create a reusable sleep function\nconst shortSleep = Sleep.createSleeper(500);\nawait shortSleep(); // Pause for 500ms\n```\n\n### Abort signal\n\n```typescript\nimport Sleep from 'sleep-please';\n\n// Abortable sleep\nconst controller = new AbortController();\n\ntry {\nawait Sleep.sleep(5000, controller.signal);\n} catch (error) {\n// Sleep was aborted\nconsole.log(error.message);\n}\n\n// Abort the sleep after 1 second\nsetTimeout(() =\u003e controller.abort(), 1000);\n```\n\n### Parallel sleeping\n\n```typescript\nimport Sleep from 'sleep-please';\n\n// Multiple parallel sleeps\nawait Promise.all([\n  Sleep.sleep(1000),\n  Sleep.sleep(1500),\n  Sleep.sleep(2000)\n]);\n```\n\n## API Documentation\n\nhttps://sasuw.github.io/sleep-please/classes/Sleep.html\n\n## Compatibility\n- Node.js 14+\n- CommonJS and ES Modules\n- TypeScript support\n\n## Performance\n- Lightweight implementation\n- Minimal overhead\n- Uses native `setTimeout`\n\n## License\n\nPermission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n## Contributing\n\nSee Github project at https://github.com/sasuw/sleep-please/","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsasuw%2Fsleep-please","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsasuw%2Fsleep-please","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsasuw%2Fsleep-please/lists"}