Chapter 6. Miscellaneous APIs
This chapter discusses a grab-bag of Chrome APIs, none of which warrants a full chapter of its own. Some of them are pretty useful, and others you’ll want to read about but will probably never use.
setTimeout functions, but their lifetime was limited to the lifetime of the program. When it stops, they’re gone.
With the Chrome alarm APIs, you can set an alarm that lasts as long as the app is installed, even if its background page goes inactive. You create such an alarm with
The second argument is an object that has the following three properties:
When the alarm should first fire, in milliseconds past the current time (
- How long to delay until the alarm first fires
- How long to wait between firings
One of the
delayInMinutes properties is required, and
periodInMinutes should be present only if you want the alarm to fire more than once.
When an alarm fires, it triggers a
chrome.alarms.onAlarm event, the callback function of which receives an
Alarm object as its argument, indicating which alarm fired. Its most important property is
You clear an alarm by using
The callback function has a Boolean argument that indicates whether the alarm was cleared.
There are also APIs to get information ...