Skip to content

Updating the front end

Mark Taylor edited this page Jan 4, 2014 · 2 revisions

You will likely want to update the HTML/ Javascript Front-End to reflect the current state of the background service.

There are three options for this:

Register for Updates

Using the [registerForUpdates] (registerForUpdates) and [deregisterForUpdates] (deregisterForUpdates) methods you can register/ deregister a Javascript function to be run on the HTML/ Javascript Front-End after each time that the [doWork] (doWork) runs.

Poll for Updates

Using the Javascript setInterval method and the [getStatus] (getStatus) method you can set a polling interval within the HTML/ Javascript Front-End to retrieve updates on a periodic basis.

Updates on request

Using the getStatus] (getStatus) method you can retrieve the updates from the HTML/ Javascript Front-End based on programmatic events (for example, user button press).