Re: Why unhandled System Messages wait in queue

On 2013-04-02 17:30, Mounir Lamouri wrote:
> On 25/03/13 14:32, Janusz Majnert wrote:
>> Hi all,
>> I have a question regarding the System Messages. Why should unhandled
>> messages wait in queue?
>
> The main use case of System Messages is when you want to send some kind
> of message/event to an application and make sure the application
> receives it. For that, you have to make sure to start the application
> before sending the message.
>
> You could then fire a simple DOM Event but as soon as a DOM Event is
> fired, if you didn't handle it, you will not be able to handle it later
> so you need to make very clear *when* the DOM Event will have to be
> fired otherwise, you will create potential race conditions.
> Unfortunately, in a page load, there is no clear and simple moment to
> fire an event. After 'load' is terribly risky because some load (like an
> external image) might dramatically delay the event.
>
> This is why we created System Messages which are events that stay in a
> queue and will then be dispatched when needed so a page can set the
> handler at any time knowing that if the event already fired, the handler
> will be executed.
>
> Does that make more sense?

Yes, it does.
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?

/Janusz

Received on Wednesday, 3 April 2013 07:53:54 UTC