dida

0.1.2 • Public • Published

Build Status Coverage Status

About

dida is a setInterval interface for async method.

Install

 
$ npm install dida

Usage

 
var _me = require('dida').create(function (sql) {
  /**
   * @ suppose an async function as _db.query
   */
  _db.query(sql, function (e, res) {
    _me.next();
  });
}, {'interval' : 100});
_me.run('SELECT SLEEP(1)');
 

or:

 
var dida = require('dida');
var timer = dida.setInterval(function () {
  _db.query('SELECT SLEEP(1)', function (e, res) {
    timer.next();  
  });
}, 100);
 
dida.clearInterval(timer);
 

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i dida

Weekly Downloads

16

Version

0.1.2

License

none

Last publish

Collaborators

  • aleafs