You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Sven Meier <sv...@meiers.net> on 2015/05/11 13:43:15 UTC

additional global ajax listener

Hi all,

I think I'm in need of a additional global ajax listener:

Up till now I utilized a subscriber to "/ajax/call/before", to show a 
veil on *all* button clicks.

But now I realized, that under certain circumstances the veil is shown 
too late:
If an Ajax request is already running (e.g. an 
AjaxFormComponentUpdatingBehavior which does *not* show the veil), a 
following double click on a button will schedule two ajax requests.
The first one will trigger the veil, but this is too late since the 
second request is already scheduled :/.

A new ajax topic will allow to solve this quite easily:
The event will be published before any throttling and/or scheduling, 
right when the triggering event occurs.

I will name the new topic "/ajax/call/init":

             Topic: {
                 ...
                 AJAX_CALL_INIT          : '/ajax/call/init',
                 AJAX_CALL_BEFORE       : '/ajax/call/before',
                 AJAX_CALL_PRECONDITION : '/ajax/call/precondition',
                 ...
             }

In Wicket 7/8 we could add IAjaxCallListener#onInitHandler(Component) too.
Any suggestions for a better name?

Regards
Sven

Re: additional global ajax listener

Posted by Sven Meier <sv...@meiers.net>.
Hi,

all current ajax topics will keep their ordering. So if you don't use 
the new listener, nothing changes.

Have fun
Sven


On 11.05.2015 14:41, Nick Pratt wrote:
> With an additional Ajax topic like this is there any ordering risk
> (happens-before / happens-after) with regards to the regular Ajax updates?
>
> N
>
> On Mon, May 11, 2015 at 7:43 AM, Sven Meier <sv...@meiers.net> wrote:
>
>> Hi all,
>>
>> I think I'm in need of a additional global ajax listener:
>>
>> Up till now I utilized a subscriber to "/ajax/call/before", to show a veil
>> on *all* button clicks.
>>
>> But now I realized, that under certain circumstances the veil is shown too
>> late:
>> If an Ajax request is already running (e.g. an
>> AjaxFormComponentUpdatingBehavior which does *not* show the veil), a
>> following double click on a button will schedule two ajax requests.
>> The first one will trigger the veil, but this is too late since the second
>> request is already scheduled :/.
>>
>> A new ajax topic will allow to solve this quite easily:
>> The event will be published before any throttling and/or scheduling, right
>> when the triggering event occurs.
>>
>> I will name the new topic "/ajax/call/init":
>>
>>              Topic: {
>>                  ...
>>                  AJAX_CALL_INIT          : '/ajax/call/init',
>>                  AJAX_CALL_BEFORE       : '/ajax/call/before',
>>                  AJAX_CALL_PRECONDITION : '/ajax/call/precondition',
>>                  ...
>>              }
>>
>> In Wicket 7/8 we could add IAjaxCallListener#onInitHandler(Component) too.
>> Any suggestions for a better name?
>>
>> Regards
>> Sven
>>


Re: additional global ajax listener

Posted by Nick Pratt <nb...@gmail.com>.
With an additional Ajax topic like this is there any ordering risk
(happens-before / happens-after) with regards to the regular Ajax updates?

N

On Mon, May 11, 2015 at 7:43 AM, Sven Meier <sv...@meiers.net> wrote:

> Hi all,
>
> I think I'm in need of a additional global ajax listener:
>
> Up till now I utilized a subscriber to "/ajax/call/before", to show a veil
> on *all* button clicks.
>
> But now I realized, that under certain circumstances the veil is shown too
> late:
> If an Ajax request is already running (e.g. an
> AjaxFormComponentUpdatingBehavior which does *not* show the veil), a
> following double click on a button will schedule two ajax requests.
> The first one will trigger the veil, but this is too late since the second
> request is already scheduled :/.
>
> A new ajax topic will allow to solve this quite easily:
> The event will be published before any throttling and/or scheduling, right
> when the triggering event occurs.
>
> I will name the new topic "/ajax/call/init":
>
>             Topic: {
>                 ...
>                 AJAX_CALL_INIT          : '/ajax/call/init',
>                 AJAX_CALL_BEFORE       : '/ajax/call/before',
>                 AJAX_CALL_PRECONDITION : '/ajax/call/precondition',
>                 ...
>             }
>
> In Wicket 7/8 we could add IAjaxCallListener#onInitHandler(Component) too.
> Any suggestions for a better name?
>
> Regards
> Sven
>

Re: additional global ajax listener

Posted by Sven Meier <sv...@meiers.net>.
Hi Martin,

 > start?!

for me it wouldn't be clear whether "/ajax/call/start" comes before or 
after "/ajax/call/before".

"/ajax/call/init" should convey something like a constructor event, i.e. 
the very first callback.

Thanks
Sven


On 11.05.2015 14:02, Martin Grigorov wrote:
> Hi,
>
> On Mon, May 11, 2015 at 2:43 PM, Sven Meier <sv...@meiers.net> wrote:
>
>> Hi all,
>>
>> I think I'm in need of a additional global ajax listener:
>>
>> Up till now I utilized a subscriber to "/ajax/call/before", to show a veil
>> on *all* button clicks.
>>
>> But now I realized, that under certain circumstances the veil is shown too
>> late:
>> If an Ajax request is already running (e.g. an
>> AjaxFormComponentUpdatingBehavior which does *not* show the veil), a
>> following double click on a button will schedule two ajax requests.
>> The first one will trigger the veil, but this is too late since the second
>> request is already scheduled :/.
>>
>> A new ajax topic will allow to solve this quite easily:
>> The event will be published before any throttling and/or scheduling, right
>> when the triggering event occurs.
>>
>> I will name the new topic "/ajax/call/init":
>>
>>              Topic: {
>>                  ...
>>                  AJAX_CALL_INIT          : '/ajax/call/init',
>>                  AJAX_CALL_BEFORE       : '/ajax/call/before',
>>                  AJAX_CALL_PRECONDITION : '/ajax/call/precondition',
>>                  ...
>>              }
>>
>> In Wicket 7/8 we could add IAjaxCallListener#onInitHandler(Component) too.
>> Any suggestions for a better name?
>>
> start?!
>
>
>> Regards
>> Sven
>>


Re: additional global ajax listener

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Mon, May 11, 2015 at 2:43 PM, Sven Meier <sv...@meiers.net> wrote:

> Hi all,
>
> I think I'm in need of a additional global ajax listener:
>
> Up till now I utilized a subscriber to "/ajax/call/before", to show a veil
> on *all* button clicks.
>
> But now I realized, that under certain circumstances the veil is shown too
> late:
> If an Ajax request is already running (e.g. an
> AjaxFormComponentUpdatingBehavior which does *not* show the veil), a
> following double click on a button will schedule two ajax requests.
> The first one will trigger the veil, but this is too late since the second
> request is already scheduled :/.
>
> A new ajax topic will allow to solve this quite easily:
> The event will be published before any throttling and/or scheduling, right
> when the triggering event occurs.
>
> I will name the new topic "/ajax/call/init":
>
>             Topic: {
>                 ...
>                 AJAX_CALL_INIT          : '/ajax/call/init',
>                 AJAX_CALL_BEFORE       : '/ajax/call/before',
>                 AJAX_CALL_PRECONDITION : '/ajax/call/precondition',
>                 ...
>             }
>
> In Wicket 7/8 we could add IAjaxCallListener#onInitHandler(Component) too.
> Any suggestions for a better name?
>

start?!


>
> Regards
> Sven
>