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@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate