Posts

Showing posts with the label closure

JavaScript Builder from Falsy Values

Update: uglify-js as third option Thanks to @kitgoncharov JSBuilder now includes the option to run uglify-js through Rhino ... still cross platform, a builder for any taste. as promised during my workshop, I have created a Google Code Project with the builder used to demonstrate most advanced and common techniques to make a library, application, snippet, small and fast. What Is JSBuilder It's a truly simple Python module based over a certain hierarchy able to combine multiple files and produce a minified version of the application. A similar approach has been used since ages with jQuery, and I am pretty sure there are tons of builders out there able to do similar task. I personally created ages ago a similar project compatible with all windows platform . However, that project was missing the possibility to put everything together, preserve some piece of code if necessary, replace some string runtime, and produce if necessary different outputs through the simplified module approac...

Google Closure ? I'm Not Impressed

We all know that Google is synonym of performances, simplicity, and again performances. A search engine that uses a truncated body for a not valid W3 markup should be the most bytes and performances maniac in the current web era, isn't it? Well, Google Closure Tools has been a negative surprise, at least this is what I can tell about it after a first quick review. Closure Compiler It's since ages I am wondering what kind of tool Big G is using to produce their scripts and finally we got the answer: Closure Compiler ... ooooh yeah! Packer , YUIC , it does not matter, when Google needs something, it creates something. This is almost intrinsic, as developers, in our DNA: we spot some interesting concept? We rewrite it from the scratch pretending we are doing it better! This is not the case, or better, something could go terribly wrong ! // ==ClosureCompiler== // @compilation_level ADVANCED_OPTIMIZATIONS // @output_file_name default.js // ==/ClosureCompiler== (function(){ ...

Famous documentation and the dark side of "this" !

The good thing of internet is that you can find a lot of free documentation. At the same time, the bad thing of internet, is that this documentation is rarely updated. It could be a "guru documentation" or it could be a newbie documentation, but in both cases, it doesn't matter because it is probably wrong, not updated, or too generic. This post has not enough space to describe every error you can find on, and off line ... so let me start with some true example about a common misunderstood referer, the this one. Douglas Crockford and Private Members in JavaScript This page is famous enough, and I suppose that every true JavaScript developer has read them at least once. The main error in that page is described in this sentence By convention, we make a private that parameter. This is used to make the object available to the private methods. This is a workaround for an error in the ECMAScript Language Specification which causes this to be set incorrectly for inner functio...