A Flight component for scheduling periodic events
bower install --save flight-schedule
Initialize & specify tick interval
var schedule = require('schedule');
schedule.attachTo(document, {
tickInterval: 10 // seconds
});
Note that the path to schedule can be configured using require.config paths or equivalent.
Listen for tick events
this.on('schedule-tick', this.doSomething);
Schedule periodic tasks
this.trigger('schedule-task', {
eventName: 'example-event', // event to be triggered
period: 2, // seconds
immediate: true // execute event immediately when task is added
}
Cancel periodic tasks
this.trigger('schedule-cancel', {
eventName: 'example-event'
});
Development of this component requires Bower, and preferably Karma to be globally installed:
npm install -g bower karma
Then install the Node.js and client-side dependencies by running the following commands in the repo's root directory.
npm install
bower install
To continuously run the tests in Chrome and Firefox during development, just run:
karma start
Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing.