[TxMt] Prototype & Scriptaculus Bundle
Andreas Wahlin
andreaswahlin at bredband.net
Sat Jul 22 09:08:30 UTC 2006
That's a great fucking explanation. Thanks a bunch!
I feel I owe some sort of tip here ... but I can't really .. oh, wait :)
tip taken from http://www.dustindiaz.com/awkward-looking-javascript/
Since javascript functions are mainly variables (sort of), you can
have a function that calls itself on initalisation, like
(function() {
do_stuff;
}());
this also works in json, so you can have immediately executing code
returned from the server. This might not be good practice, but it
sure shows how cool javascript is :)
sorry everyone for the OT stuff, but if you read this
thread,hopefully your interested in some javascript voodoo anyway.
Andreas
On Jul 21, 2006, at 23:49 , thomas Aylott wrote:
> On Jul 21, 2006, at 4:47 PM, Andreas Wahlin wrote:
>> If you use prototype, there's a modified version in there that
>> adds .bind(this)
>>
>> *cough* slightly off topic. The .bind(this) just makes the this
>> keyword accessibly in the function that you bind it to, right?
>> Sort of like passing it in as an argument when you call the function.
>>
>> Andreas
>
> .bind() replaces every use of "this" inside with a call to the
> object you put in the argument. Like so:
>
> function(){
> alert(this.thinggy);
> }.bind({thinggy: 'Howdy!!!'})
>
>
> thomas Aylott—subtleGradient
>
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20060722/f2aed822/attachment.html>
More information about the textmate
mailing list