[Proto-Scripty] Re: callback decoration

2009-12-17 Thread Eric
Hi Sergio,

I am not sure what you mean by make the bind but here is an example
doing what you ask using ajax responders:

Ajax.Responders.register({
  onCreate: function(ar)
  {
ar.options.onSuccess = ar.options.onSuccess ||
Prototype.emptyFunction;

ar.options.onSuccess = ar.options.onSuccess.wrap(function
(localCB,xhr,xjs)
{
  // Do your stuffs here
  alert(Apex inboud!);

  // Then call the provided callback
  localCB(xhr,xjs);
});
  }
});

new Ajax.Request('http://jsbin.com/azeyo',{
  onSuccess: function(xr) { alert(CB:+xr.responseText); }
});


You can see it working here: http://jsbin.com/afudi and play with the
code here: http://jsbin.com/afudi/edit

Eric

--

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.




[Proto-Scripty] Re: callback decoration

2009-12-15 Thread Sergio Fernández
Using Ajax.Request(), I forgot to say it, sorry.

On Dec 15, 3:45 pm, Sergio Fernández wik...@wikier.org wrote:
 In a experiment, I'm trying to decorate the callbacks, but I didn't
 find the way to make the bind...

 What I'd like to do is to firstly get the control over response's
 callback, do some common stuff, and then invoke the callback set by
 the user.

 Anyone has any idea how can I do something like that?

 Thanks in advance.

 Best

--

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.