Pebble's JavaScript API allows developers to write watchfaces in JavaScript, that are executed via the firmware's JerryScript engine. For instructions on getting started with Pebble's JavaScript API, see the JS Watchface Tutorial.
The JavaScript API is broken down into the following modules:
The JavaScript API also includes the following global functions:
Calls a function after a specified delay.
var timeoutId = setTimeout(function(...){}, 10000);
The function to execute
The delay (in ms)
timeoutId - The ID of the timeout
Clears the delay set by setTimeout
.
clearTimeout(timeoutId);
The ID of the timeout you wish to clear.
Repeatedly calls a function, with a fixed time delay between each call.
var intervalId = setInterval(function(...){}, 10000);
The function to execute
The delay (in ms)
intervalId - The ID of the interval
Clears the interval set by setInterval
.
clearInterval(intervalId);
The ID of the interval you wish to clear
To learn more about how to use this part of the Pebble SDK, check out the JavaScript Watchface tutorial, which also includes links to example apps.
Web API by Mozilla Contributors is licensed under CC-BY-SA 2.5.