Brian Arnold
Member since Apr 28, 2010
- Profile: /members/5920-brian-arnold.htm
- URL: http://www.randomthink.net/
- Comments: 8
Recent Blog Comments By Brian Arnold
-
Using Named Functions Within Self-Executing Function Blocks In Javascript
Posted on Aug 16, 2010 at 9:48 AM
Erm - I didn't actually link in the gist. http://gist.github.com/360138 There we go. Sorry about that.... read more »
-
Using Named Functions Within Self-Executing Function Blocks In Javascript
Posted on Aug 16, 2010 at 9:48 AM
This approach is pretty great - I'm a fan. I picked it up from this gist from Ben Alman (which itself was forked from a gist from Remy Sharp), which shows some other ways to use this technique (such as waiting before the first execution or using setInterval instead of setTimeout). Also, given that... read more »
-
Using The WITH Keyword With Javascript's Function() Constructor
Posted on May 20, 2010 at 10:04 AM
If you look into the interiors of some of the templating stuff out there (I believe I saw it in jQuery.tmpl and I know Underscore.js does it), they do something very similar with `with` to get the templating to work. http://github.com/documentcloud/underscore/blob/master/underscore.js around line... read more »
-
Javascript Function() Constructor Does Not Create A Closure
Posted on May 6, 2010 at 9:48 PM
@Ben, You can eval huge chunks of logic. http://blog.sproutcore.com/post/225219087/faster-loading-through-eval I just started listening to The Dev Show on 5by5.tv ( http://5by5.tv/devshow ) and they talked about that link above on their first show. Surprising results, to say the least. Chec... read more »
-
Javascript Function() Constructor Does Not Create A Closure
Posted on Apr 28, 2010 at 11:50 AM
@Ben, I should have watched the video. I was waking up and trying to be quiet or might have otherwise. :D Also, I decided to go reading, and on page 117 of the ECMAScript language spec I dug up (well, page 127 of the PDF but it's numbered 117), it explicitly says that when using the function cons... read more »
-
Javascript Function() Constructor Does Not Create A Closure
Posted on Apr 28, 2010 at 8:57 AM
Posted a bit prematurely: I realize you're aware that the non-quoted syntax works fine, but guess there's likely a reason for trying to use the new Function syntax that I'm not aware of. :D... read more »
-
Javascript Function() Constructor Does Not Create A Closure
Posted on Apr 28, 2010 at 8:54 AM
I'm not sure if I've really seen functions created like that. If you tweak the interior to something like: var testScope = function() { console.log( scope ); }; Then it outputs 'function' instead of 'window'. Definitely seems like something about going the new Function route breaks the in... read more »