Hi,

On Jun 24, 3:15 am, Jason 'XenoPhage' Frisvold
<xenoph...@godshell.com> wrote:
> > In any given application, I tend to have a  wrapper around Prototype's
> > ajax stuff with some problem-domain logic in it. That wrapper always
> > checks for the `success` flag on calls and routes to the error handler
> > if it's not there.
>
> Which would, I suppose, extend the framework to be even more generic..  Hrm.. 
>  Presumably
> this is just a simple subroutine call?  Not much of a performance hit, is it?

No, no perceptible performance hit, even on IE. There may be one extra
function call setting up the request and one extra call handling the
response, or depending on how you use your Ajax calls and objects,
there may not be any extra calls at all. Either way, you don't have to
worry about function calls (even on IE) unless you're dealing with a
tight loop doing thousands of them (perhaps hundreds on IE).

The reason I may not be ending up with more calls at all is that
frequently my ajax callbacks need access to the object initiating the
request. Many times people deal with that by calling Function#bind to
create the ajax callback so that the calling object becomes `this`. My
wrapper supports a `context` parameter (which I've suggested to the
Prototype core team[1]) making that unnecessary, so I save the
Function#bind call (which involves more function calls and the
creation of a function object) on setup and the bound function's call
to the actual handler on response -- probably ending up being a bit
more efficient.

[1] 
https://prototype.lighthouseapp.com/projects/8886/tickets/1030-add-context-parameter-to-ajax-options

FWIW,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com

-- 
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