Skip to content
This repository has been archived by the owner on Apr 1, 2019. It is now read-only.
/ sw-task-scheduler Public archive

Task scheduler inside a Service Worker (proof-of-concept)

Notifications You must be signed in to change notification settings

cgrs/sw-task-scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ServiceWorker task scheduler

This is a proof of concept of a task scheduler inside a ServiceWorker.

How?

The Service Worker has a non-blocking infinite loop (using setInterval) constantly checking in a task queue Set whether the due date arrives and runs the task.

When a user sends a task message to the service worker:

  1. It adds the task to a list of pending tasks
  2. Then the worker compares the scheduled date of the task against a Date object with the actual date
  3. If dates match, the task is run and a notification is shown
  4. The task is added to a Set of done tasks (to keep track of already done tasks)

Preview

$ git clone https://github.com/cgrs/sw-task-scheduler.git
$ cd sw-task-scheduler
$ npm install
$ npm start

About

Task scheduler inside a Service Worker (proof-of-concept)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published