tbrd / flight-schedule

Schedule periodic tasks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

flight-schedule

Build Status

A Flight component for scheduling periodic events

Installation

bower install --save flight-schedule

Example

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

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

Contributing to this project

Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing.

About

Schedule periodic tasks

License:MIT License


Languages

Language:JavaScript 100.0%