callback registry

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

callback registry

Karsten Kusche
Hi there,

is there a way to clean up the callback registry, or to unregister some
callbacks?
The reason i ask is when you have a webpage that works almost only via
Ajax and like never does normal callbacks, you end up with a very long
callback registry that has a lot of blocks that are probably never
called. If you don't pay attention to the kind of objects that you
reference in such a callback, you might very well end up having memory
leaks.

It's a tricky problem, but maybe someone knows how to approach it.

Kind Regards
Karsten


--
Karsten Kusche - Dipl.Inf. - [hidden email]
Tel: +49 3496 21 43 29
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: callback registry

Lukas Renggli
> is there a way to clean up the callback registry, or to unregister some
> callbacks?

With the model of Seaside, it is hard to tell what callbacks are still
used when doing AJAX. Therefore I suggest to do a full refresh from
time to time.

Note that you can easily do a full refresh through AJAX. Just trigger
an AJAX request to a normal callback, extract the string between
<body> and </body> and place it into the DOM tree. This recreates all
the callbacks in the page and ensures that old ones eventually expire.
To the outside this "full request" feels like a normal AJAX action,
just that it is maybe a bit slower than the other ones.

Actually I planned to write a blog entry about this technique, just
didn't find the time yet.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: callback registry

Karsten Kusche
Hi Lukas,

thanks for the reply. Could you please tell me a bit more about the
details, especially on the client-side javascript?

Kind Regards
Karsten



Lukas Renggli wrote:

>> is there a way to clean up the callback registry, or to unregister some
>> callbacks?
>>    
>
> With the model of Seaside, it is hard to tell what callbacks are still
> used when doing AJAX. Therefore I suggest to do a full refresh from
> time to time.
>
> Note that you can easily do a full refresh through AJAX. Just trigger
> an AJAX request to a normal callback, extract the string between
> <body> and </body> and place it into the DOM tree. This recreates all
> the callbacks in the page and ensures that old ones eventually expire.
> To the outside this "full request" feels like a normal AJAX action,
> just that it is maybe a bit slower than the other ones.
>
> Actually I planned to write a blog entry about this technique, just
> didn't find the time yet.
>
> Cheers,
> Lukas
>
>  

--
Karsten Kusche - Dipl.Inf. - [hidden email]
Tel: +49 3496 21 43 29
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: callback registry

Lukas Renggli
> thanks for the reply. Could you please tell me a bit more about the details,
> especially on the client-side javascript?

http://www.lukas-renggli.ch/blog/ajaxification

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: callback registry

Marco D'Ambros
Hi,

I tried to insert the script in a seaside application, in the  
#updateRoot: method like this:

updateRoot: root
        super updateRoot: root.
        root javascript resourceUrl: 'http://www.prototypejs.org/assets/2008/9/29/prototype-1.6.0.3.js' 
.
        root javascript add: '$(document.body).observe("click", function  
(event) {
    var element = Event.element(event);
    var extractor = /]*>((.|\s)*)<\/body>/;
    if (!element.href) element = element.up("a");
    if (element.href) {
        new Ajax.Request(element.href, {
            method: "get",
            requestHeaders: [ "X-Requested-With", "" ],
            onSuccess: function (transport) {
                document.body.innerHTML =
                   extractor.exec(transport.responseText)[1];
            }
    });
    Event.stop(event);
    }
}.bindAsEventListener());'


but it seems that I did not succeed.
Am I doing something wrong?

Cheers and thanks
Marco


On Oct 24, 2008, at 8:42 PM, Lukas Renggli wrote:

>> thanks for the reply. Could you please tell me a bit more about the  
>> details,
>> especially on the client-side javascript?
>
> http://www.lukas-renggli.ch/blog/ajaxification
>
> Cheers,
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: callback registry

Lukas Renggli
You need to add the code to the load script (#addLoadScript:),
otherwise the DOM is not ready yet.

Cheers,
Lukas

On Wed, Oct 29, 2008 at 8:57 AM, Marco D'Ambros
<[hidden email]> wrote:

> Hi,
>
> I tried to insert the script in a seaside application, in the #updateRoot:
> method like this:
>
> updateRoot: root
>        super updateRoot: root.
>        root javascript resourceUrl:
> 'http://www.prototypejs.org/assets/2008/9/29/prototype-1.6.0.3.js'.
>        root javascript add: '$(document.body).observe("click", function
> (event) {
>   var element = Event.element(event);
>   var extractor = /]*>((.|\s)*)<\/body>/;
>   if (!element.href) element = element.up("a");
>   if (element.href) {
>       new Ajax.Request(element.href, {
>           method: "get",
>           requestHeaders: [ "X-Requested-With", "" ],
>           onSuccess: function (transport) {
>               document.body.innerHTML =
>                  extractor.exec(transport.responseText)[1];
>           }
>        });
>        Event.stop(event);
>   }
> }.bindAsEventListener());'
>
>
> but it seems that I did not succeed.
> Am I doing something wrong?
>
> Cheers and thanks
> Marco
>
>
> On Oct 24, 2008, at 8:42 PM, Lukas Renggli wrote:
>
>>> thanks for the reply. Could you please tell me a bit more about the
>>> details,
>>> especially on the client-side javascript?
>>
>> http://www.lukas-renggli.ch/blog/ajaxification
>>
>> Cheers,
>> Lukas
>>
>> --
>> Lukas Renggli
>> http://www.lukas-renggli.ch
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside