i would suggest you to join the IRC channel and discuss it there.

--
Fábio Miranda Costa
Solucione Sistemas
Front-End Engineer
http://meiocodigo.com


2009/7/27 Fábio M. Costa <[email protected]>

> I dont know why its done this way, maybe its a bug or this may be the
> behavior they wanted.
>
> --
> Fábio Miranda Costa
> Solucione Sistemas
> Front-End Engineer
> http://meiocodigo.com
>
>
> On Mon, Jul 27, 2009 at 5:34 AM, Alexey A <[email protected]> wrote:
>
>>
>> Yep, your solution is cool in case the function is described right in
>> Request description.
>> And as for me, the main problem is to understand why is it Window
>> objects passes as `this` when there are no bind attr in pass(). Later
>> I`ll try to look through Mootools code for this, but I`m no to cool to
>> understand that code rapidly....
>>
>> On Jul 25, 7:44 pm, Fábio M. Costa <[email protected]> wrote:
>> > var v = "Some var";
>> > var testReq = new Request.JSON({
>> > url:"/test/",
>> > onRequest:function(){
>> >    alert (this+'\n'+v)
>> >
>> > }
>> > }).send();
>> >
>> > this shoud work.
>> > pass binds the windows element to the function, if you dont specify the
>> > second argument.
>> >
>> > But as you can see you dont need pass or bind in this case... do you?
>> >
>> > But ill talk to some ppl about this behavior.
>> >
>> > --
>> > Fábio Miranda Costa
>> > Solucione Sistemas
>> > Front-End Engineerhttp://meiocodigo.com
>> >
>> > On Sat, Jul 25, 2009 at 10:32 AM, Alexey A <[email protected]>
>> wrote:
>> >
>> > > I've got a simple request
>> >
>> > > var v = "Some var";
>> > > var testReq = new Request.JSON({
>> > > url:"/test/",
>> > > onRequest:function(v){alert (this+'\n'+v)}.pass(v)
>> > > }).send();
>> >
>> > > And it shows me:
>> >
>> > > [object Window]
>> > > Some var
>> >
>> > > But, if I remove pass() I got
>> >
>> > > [object Object]
>> > > undefined
>> >
>> > > And the Object here is my request object (instead of Window object
>> > > with pass())
>> >
>> > > Am I write that it's a strange behavior? Or maybe someone could
>> > > explain me why it should be Window instead of Request associated with
>> > > *this*?
>> >
>> > > I've found only one solution: I've added onRequest like this:
>> >
>> > > testReq.setOptions({onRequest : on_request.bind(testReq, v)})
>> >
>> > > just before sending it.
>>
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MooTools Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/mootools-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to