- From: Janusz Majnert <j.majnert@samsung.com>
- Date: Fri, 05 Apr 2013 09:37:05 +0200
- To: public-sysapps@w3.org
On 2013-04-04 17:43, Mounir Lamouri wrote:
> On 03/04/13 08:53, Janusz Majnert wrote:
>> I'm still curious how/if an application can "unregister" itself from
>> receiving system messages. Or maybe there is a way to flush the message
>> queue?
>
> setMessageHandler('foo', null) will make sure the application no longer
> receives system messages of type 'foo'.
I think that what the spec currently says is that setting the calback to
null doesn't stop the application from receiving system messages:
"If callback is null, the current callback, if any, for the type of
message type must be reset and no callback should no longer be set for
this type."
Then if you set the callback to some function, you will have to handle
all the messages that arived when calback was null:
"If callback is not null and there was no message handler for the given
type and there are messages in the pool of messages for the type, then
the UA MUST start an asynchronous task that executes all the messages in
the pool by the new handler in a FIFO basis and then remove all those
messages from the pool of messages."
Also, the concept of "registering" for system messages is not clear. Is
the first call to setMessageHandler("foo",valid_handler) or
setMessageHandler("foo", invalid_handler) or setMessageHandler ("foo",
null) registering an app for messages of type "foo"?
/Janusz
Received on Friday, 5 April 2013 07:37:48 UTC