Confirmed users
110
edits
(→FAQ: Descirve how to set the messages property for app before using mozSetMessageHandler.) |
m (→Examples) |
||
Line 75: | Line 75: | ||
navigator.mozAlarms.remove(alarmId2); | navigator.mozAlarms.remove(alarmId2); | ||
* How to listen to the alarm | * How to listen to the <code>"alarm"</code> message with a callback function which will run whem an alarm goes off? | ||
navigator.mozSetMessageHandler("alarm", function (message) { alert("alarm fired: " + JSON.stringify(message)); }); | navigator.mozSetMessageHandler("alarm", function (message) { alert("alarm fired: " + JSON.stringify(message)); }); | ||
* How to know in advance if there exists any pending alarm | * How to know in advance if there exists any pending <code>"alarm"</code> messages? | ||
navigator.mozHasPendingMessage("alarm"); | navigator.mozHasPendingMessage("alarm"); |