WebAPI/AlarmAPI: Difference between revisions

Jump to navigation Jump to search
→‎FAQ: correct messages property
(→‎FAQ: correct messages property)
Line 91: Line 91:
** You have to add a <code>messages</code> property in the application's manifest. The <code>messages</code> property is used to register the application as a potential target for catching certain types of messages, while <code>mozSetMessageHandler(...)</code> actually sets up the callback function that handles them. If you just call <code>mozSetMessageHandler(...)</code> without registering the <code>"alarm"</code> message previously, you won't receive it when an alarm goes off. Therefore, you have to add a <code>messages</code> property for registering the <code>"alarm"</code> message like below:
** You have to add a <code>messages</code> property in the application's manifest. The <code>messages</code> property is used to register the application as a potential target for catching certain types of messages, while <code>mozSetMessageHandler(...)</code> actually sets up the callback function that handles them. If you just call <code>mozSetMessageHandler(...)</code> without registering the <code>"alarm"</code> message previously, you won't receive it when an alarm goes off. Therefore, you have to add a <code>messages</code> property for registering the <code>"alarm"</code> message like below:


   "messages": ["alarm"]
   "messages": [
    { "alarm": "/index.html" }
  ]


* I've already added a <code>messages</code> property for registering the <code>"alarm"</code> message and set the system message handler for handling that. Why can't I receive that when the alarm goes off?
* I've already added a <code>messages</code> property for registering the <code>"alarm"</code> message and set the system message handler for handling that. Why can't I receive that when the alarm goes off?
Confirmed users
933

edits

Navigation menu