Use setTimeout if you want the timer to fire only as long as the app is
still running. For example to implement some in-game action that's supposed
to happen at a certain time.

Use the mozAlarm API if you need the timer to fire even if the app is not
currently running. For example to display a notification to the user that
it's time to pick up your kids from school, or to synchronize emails.

Never ever use a wake lock and setTimeout to accomplish the latter use
case. Wake locks use a lot of battery.

/ Jonas
On Oct 15, 2014 1:58 AM, "Jan Jongboom" <[email protected]> wrote:

> If I add a setTimeout() call in system, but I don't have a CPU wake lock,
> can I assume that this function will be called?
> _______________________________________________
> dev-b2g mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-b2g
>
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to