1

I have developed Google chrome extension in which I am using chrome.alarms api. (https://developer.chrome.com/extensions/alarms) I am moving this extension to crossrider now. Is there any equivalent api in crossrider for chrome.alarms api.

How can I schedule code to run periodically in crossrider extension.

user1142864
  • 89
  • 1
  • 7

1 Answers1

4

The chrome.alarms API exists because of event pages, which are inactive background pages (to save memory and resources).

In Crossrider, the background page is persistent, i.e. it never suspends unless the browser is closed. There is no direct chrome.alarms equivalent in Crossrider, but you rewrite your code to schedule tasks with timers using appAPI.setInterval (periodic) and appAPI.setTimeout (once) as primitives.

Rob W
  • 341,306
  • 83
  • 791
  • 678