Getting ID of an updated zone

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Getting ID of an updated zone

Adam X
Hi,

I'm trying to wrap my head around the new 5.4 JS support. I have the
following module which gets invoked whenever a zone is updated,
however, I have 12 zones on my page periodically updated. I don't know
at runtime which zone is updated, but I need to be notified about it.

So I have the following module:

define(["t5/core/dom", "t5/core/events"], function(dom, events) {

    return function() {
        dom.onDocument(events.zone.didUpdate, function() {
            alert('how can I get ID of a zone that was updated?');
        });
    }
});

I have a hard time figuring out how to pass the ID of a zone that was updated.

Adam

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting ID of an updated zone

Lance Java
If you want streaming updates to a page you might be interested in
tapestry-atmosphere or tapestry-cometd rather than 12 periodic updates on a
page.

https://github.com/uklance/tapestry-atmosphere
http://t5atmosphere-lazan.rhcloud.com/

https://github.com/uklance/tapestry-cometd
http://t5cometd-lazan.rhcloud.com/

On 17 Sep 2016 9:17 a.m., "Adam X" <[hidden email]> wrote:

> Hi,
>
> I'm trying to wrap my head around the new 5.4 JS support. I have the
> following module which gets invoked whenever a zone is updated,
> however, I have 12 zones on my page periodically updated. I don't know
> at runtime which zone is updated, but I need to be notified about it.
>
> So I have the following module:
>
> define(["t5/core/dom", "t5/core/events"], function(dom, events) {
>
>     return function() {
>         dom.onDocument(events.zone.didUpdate, function() {
>             alert('how can I get ID of a zone that was updated?');
>         });
>     }
> });
>
> I have a hard time figuring out how to pass the ID of a zone that was
> updated.
>
> Adam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting ID of an updated zone

Ido Dovrat-2
In reply to this post by Adam X
Where do you want to pass this id? Back to the server? If so, maybe it
would be more efficient to log this info on the server while you are
rendering the new html for the updated zone, before the response is even
sent (instead of waiting for the zone to be updated, then sending a new
request to the server informing it of the update)?

On Sat, Sep 17, 2016 at 11:17 AM, Adam X <[hidden email]> wrote:

> Hi,
>
> I'm trying to wrap my head around the new 5.4 JS support. I have the
> following module which gets invoked whenever a zone is updated,
> however, I have 12 zones on my page periodically updated. I don't know
> at runtime which zone is updated, but I need to be notified about it.
>
> So I have the following module:
>
> define(["t5/core/dom", "t5/core/events"], function(dom, events) {
>
>     return function() {
>         dom.onDocument(events.zone.didUpdate, function() {
>             alert('how can I get ID of a zone that was updated?');
>         });
>     }
> });
>
> I have a hard time figuring out how to pass the ID of a zone that was
> updated.
>
> Adam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting ID of an updated zone

Adam X
Thanks for the suggestion about t5atmosphere. I will definitely look into it.

I do not want to send ids back to the server. I simply want my client
side javascript get invoked after zone is updated (after zone
javascript update executed) and I would like to receive an id of the
zone that was just updated as a function parameter in my javascript.

Adam

On Sat, Sep 17, 2016 at 11:39 AM, Ido Dovrat <[hidden email]> wrote:

> Where do you want to pass this id? Back to the server? If so, maybe it
> would be more efficient to log this info on the server while you are
> rendering the new html for the updated zone, before the response is even
> sent (instead of waiting for the zone to be updated, then sending a new
> request to the server informing it of the update)?
>
> On Sat, Sep 17, 2016 at 11:17 AM, Adam X <[hidden email]> wrote:
>
>> Hi,
>>
>> I'm trying to wrap my head around the new 5.4 JS support. I have the
>> following module which gets invoked whenever a zone is updated,
>> however, I have 12 zones on my page periodically updated. I don't know
>> at runtime which zone is updated, but I need to be notified about it.
>>
>> So I have the following module:
>>
>> define(["t5/core/dom", "t5/core/events"], function(dom, events) {
>>
>>     return function() {
>>         dom.onDocument(events.zone.didUpdate, function() {
>>             alert('how can I get ID of a zone that was updated?');
>>         });
>>     }
>> });
>>
>> I have a hard time figuring out how to pass the ID of a zone that was
>> updated.
>>
>> Adam
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting ID of an updated zone

Chris Poulsen
Check to see what "this" refers to in the handler? Isn't that often the
element that triggered the event?

On Sat, Sep 17, 2016 at 12:25 PM, Adam X <[hidden email]> wrote:

> Thanks for the suggestion about t5atmosphere. I will definitely look into
> it.
>
> I do not want to send ids back to the server. I simply want my client
> side javascript get invoked after zone is updated (after zone
> javascript update executed) and I would like to receive an id of the
> zone that was just updated as a function parameter in my javascript.
>
> Adam
>
> On Sat, Sep 17, 2016 at 11:39 AM, Ido Dovrat <[hidden email]> wrote:
> > Where do you want to pass this id? Back to the server? If so, maybe it
> > would be more efficient to log this info on the server while you are
> > rendering the new html for the updated zone, before the response is even
> > sent (instead of waiting for the zone to be updated, then sending a new
> > request to the server informing it of the update)?
> >
> > On Sat, Sep 17, 2016 at 11:17 AM, Adam X <[hidden email]> wrote:
> >
> >> Hi,
> >>
> >> I'm trying to wrap my head around the new 5.4 JS support. I have the
> >> following module which gets invoked whenever a zone is updated,
> >> however, I have 12 zones on my page periodically updated. I don't know
> >> at runtime which zone is updated, but I need to be notified about it.
> >>
> >> So I have the following module:
> >>
> >> define(["t5/core/dom", "t5/core/events"], function(dom, events) {
> >>
> >>     return function() {
> >>         dom.onDocument(events.zone.didUpdate, function() {
> >>             alert('how can I get ID of a zone that was updated?');
> >>         });
> >>     }
> >> });
> >>
> >> I have a hard time figuring out how to pass the ID of a zone that was
> >> updated.
> >>
> >> Adam
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Loading...