New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

loopnext

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loopnext

Run loops with async statements in a sync fashion. Did I tell you about nested sync loops?

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

loopNext

Build Status

Run loops with async statements in a sync fashion. Did I tell you about nested sync loops? ;)

To use

  • Install it:
```bash
$ npm i loopnext
```

2. Require it and use:

```js
var LoopNext = require('loopnext');
var loop = new LoopNext();
loop.syncLoop(iterations, function (l) {
  // loop body
  // call `l.next()` for next iteration
});
```

Example

var LoopNext = require('loopnext');

var loop = new LoopNext();
var count = 0;
loop.syncLoop(4, function (l) {
  setTimeout(function () {
    console.log(count);
    count++;
    l.next();
  }, 3000);
});
// 0
// 1
// 2
// 3

License

MIT © 2015 Sunny (darkowlzz)

Keywords

loop

FAQs

Package last updated on 22 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts