News for hackers. Stuff that matters.
Re:Angular 2 Style Guide by Roboprog on Thursday May 05, 2016 @11:27PM (#11641482)
How many symbols are all of those .ts files going to put into the global namespace?
Re:Angular 2 Style Guide by scriby on Thursday May 05, 2016 @11:43PM (#11641541)
The .ts files will be compiled to AMD modules, so none of the declarations will be in the global scope.
Re:Angular 2 Style Guide by Roboprog on Friday May 06, 2016 @11:48AM (#11644740)
Thanks, I had not seen that before. Interesting trick: Call a "registration" function with a string array (of dependencies) and an anonymous function (IIFE) with parameters for each dependency which the registration function injects. Thus, the dependencies are accessed as closures over the outermost func's params, rather than as globals.

E.g. -

    define( [ 'jQuery' ], function ( $ ) { ... return { ... } } )
where the 1st elipses are all the private/setup code, and the second elipses are whatever methods/properties the module exports. (this dummy only wants jQuery, but the list can be longer)