You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iotcat
d328913389
|
5 years ago | |
---|---|---|
.. | ||
test | 5 years ago | |
.travis.yml | 5 years ago | |
LICENSE | 5 years ago | |
README.md | 5 years ago | |
index.js | 5 years ago | |
package.json | 5 years ago |
README.md
looper
Loop with callbacks but don't RangeError
Synopsis
Normally, if mightBeAsync
calls it's cb immediately
this would RangeError
:
var l = 100000
;(function next () {
if(--l) mightBeAsync(next)
})
looper
detects that case, and falls back to a while
loop,
Example
var loop = require('looper')
var l = 100000
loop(function () {
var next = this
if(--l) probablySync(next)
})()
when you want to stop looping, don't call next
.
looper
checks if each callback is sync or not,
so you can even mix sync and async calls!
License
MIT