Stop.js
:bird: The Promise base `setTimeout`, release your callback
Install / Use
/learn @rwu823/Stop.jsREADME
Stop.js
The Promise based setTimeout and setImmediate for the modern browsers and node.
‼️Important
stop.js change to use milliseconds as default unit. #1
Browser Supported

Why
In ES7 async/await is awesome, but that only supported with Promise.
Installation
npm i --save stop.js
Includes babel-polyfill before use async and await
Before
console.log(1)
setTimeout(()=>{
console.log(2) // slow than 5 secs
}, 5000)
After
import stop from 'stop.js'
async function asyncFunc() {
console.log(1)
await stop(5000)
console.log(2) // slow than 5 secs
}
asyncFunc()
setImmediate
0 is default, it'll call the YuzuJS/setImmediate library
console.log(1)
setImmediate(()=>{
console.log(2)
})
same as
console.log(1)
await stop(0)
console.log(2)
or pass nothing
console.log(1)
await stop()
console.log(2)
API
stop([ms = 0])
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
