var Interval = require('Interval');
var count = 0;
var runner = Interval.run(function() {
console.log(++count);
}, 1000);
runner.pauseWhen(function() {
return count % 10 == 0;
}, 1000);
runner.whenPaused(function() {
console.log('paused');
});
runner.until(function() {
return count == 100;
});
runner.end(function() {
console.log('stopped');
});
Interval.run(function() {
console.log(++count);
}, 1000).pauseWhen(function() {
return count % 10 == 0;
}, 500).whenPaused(function() {
console.log('paused');
}).until(function() {
return count == 100;
}).end(function() {
console.log('stopped');
});