Skip to content

zswang/jchecks

Repository files navigation

jchecks

NPM version Build Status Coverage Status

checklist

使用方法

示例

  var flag = 0;
  var flagTimer = setInterval(function () {
      flag++;
  }, 1000);
  var checklist = new jchecks.Checklist({
    items: [{
      checker: function () {
        console.log('checker 1')
        return flag > 0
      },
      processor: function () {
        console.log('processor 1')
        return null
      },
      timeout: 5000,
    }, {
      checker: function () {
        console.log('checker 2')
        return flag > 3
      },
      processor: function () {
        console.log('processor 2')
        return null
      },
    }]
  });

  checklist.on('error', function (error) {
	console.error(error);
  }).on('stop', function () {
	console.info('stop');
  });

License

MIT © zswang