I like the technique you describe here, but when i try to reference 
'theElement' in NamedActionResponseHandler() it is not defined.

I changed the onComplete def to:
 onComplete: NamedActionResponseHandler.bind(this, theElement)

And changed the function to
 function NamedActionResponseHandler(theResponse, theElement)

In the function I get 'theResponse' as the returned xml still, but 
'theElement' is undefined, am i missing something?


Martin Bialasinski wrote:
> On 4/10/06, Michael Peters <[EMAIL PROTECTED]> wrote:
>> change this function to return another function. Something like this:
> 
> Yes, this is also what .bind() does to form a closure without having
> to change NamedActionResponseHandler
> 
>> And then call it like this:
>>   onComplete: NamedActionResponseHandler(theElement),
> 
> onComplete: NamedActionResponseHandler.bind(this, theElement)
> 
> theElement will now be passed as an additional argument to
> NamedActionResponseHandler, when it is called via onComplete.
> 
> Bye,
>   Martin


-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to