Skip to content

stevelaw/Scheduler

Repository files navigation

What is it?

A simple job scheduler for managing periodic jobs.

Features

  • Uses human-friendly strings for managing jobs.
  • Universal Module (UMD), supporting traditional browser environments, common script loaders (ie. RequireJS), and Node environment.
  • Comprehensive Jasmine Tests

Dependencies

None

API

addJob(options, replace)
	where 
		options.name
			Job name			
		options.interval
			Interval How often the job should run			
		options.fn
			Single function reference or array of references to be called
			when the timer fires.			
		options.immediate
			Execute the function immediately.			
		options.persist
			Prevents job from being paused via pauseAllJobs() or 
			removeAllJobs() methods.		  
		 replace
			If a job by the name already exists, then replace it. Defaults to 
			false.
		
	returns 
		N/A

removeJob(jobName)
	where 
		jobName
			The name of the job to remove.
				
	returns
		True upon success, false otherwise.	
		
runJob(jobName)	

pauseJob(jobName)

resumeJob(jobName)

removeAllJobs()

pauseAllJobs()

resumeAllJobs()

Usage

Add a Job and a Single Callback

var scheduler = new Scheduler();

scheduler.addJob({
	name : "name",
	interval : 1000,
	fn : function(){
		// I'll be called in approximately 1000ms		
	}
});	

About

A simple JavaScript job scheduler.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published