Skip to content

An intelegent scheduler to run asynchronous functions in order

License

Notifications You must be signed in to change notification settings

sjelin/zoned-scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zoned Scheduler

This allows you to to schedule asynchronous functions to run in squence.

var scheduler = new require('zoned-scheduler')();
var q = require('q');

console.log('first');

scheduler.schedule(() => {
  console.log('second');
});

scheduler.schedule(() => {
  return q.delay(100).then(() => {
    console.log('third');
  });
});

scheduler.schedule(() => {
  console.log('fourth');
});

It uses zone.js to allow you to schedule one task inside another:

console.log('first');

scheduler.schedule(() => {
  console.log('second');
  scheduler.schedule(() => {
    console.log('fourth');
  });
  return q.delay(100).then(() => {
    console.log('third');
    scheduler.schedule(() => {
      console.log('fifth');
    });
  });
});

scheduler.schedule(() => {
  console.log('sixth');
});

(See API.md for a list of commands)

About

An intelegent scheduler to run asynchronous functions in order

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published