Hello everyone,

first of all I'd like to thank all of you, who made Prototype that
good. It really helps me in my projects everyday.

And because I'm so thankful, I now want to start sharing all my ideas
and plugins I made with Prototype and script.aculo.us. So I would be
very happy about any reports, comments, feedback, bugs, ... you find
in my posts (apart from my english - sorry for that).

As the title says I want to report an idea for updating the
Ajax.PeriodicalUpdater today. I use Cufón in my projects very often.
Usually Cufón only replaces text with a special font when the page is
loaded. But I want to replace text after loading something with AJAX.
In Cufón you can easily use Cufon.refresh() but whats up with
Ajax.PeriodicalUpdater. There are two possible callback functions:

1. onSuccess, which is called before the element is updated. Bad
choice, because I have to replace text after the update.
2. onComplete, which is called after the element was updated. Okay,
that sounds great. But it is called only when you use the stop
function of the Ajax.PeriodicalUpdater instance.

So, whats up with my problem? Okay, after searching for a long time I
start with building my own Ajax.PeriodicalUpdater based on the
orignial and here it is:

Ajax.NewPeriodicalUpdater = Class.create(Ajax.PeriodicalUpdater, {
  updateComplete: function($super, response) {
    $super(response);
    (this.options.onUpdateComplete ||
Prototype.emptyFunction).apply(this, arguments);
  }
});

So. Now I can call it very easy by only implemting a special
onUpdateComplete callback. For example:

new Ajax.NewPeriodicalUpdater('ajax-update', 'test.htm', {
  onUpdateComplete: function() {
    Cufon.refresh();
  }
});

So, maybe this would be a nice thing to put into Prototype with the
next update. But for now you can use it this way.

Best regards,
Lemmi

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to