angularjs - TypeScript and Angular - when to use a module vs an IIFE -


i'm starting out using typescript angular. looking through sample applications, , see .js starts iife, while other times file starts module declaration.

can explain when 1 of these should used on other?

when write module in typescript:

module mymodule {     export class example {      } } 

the result invoked function expression:

var mymodule; (function (mymodule) {     var example = (function () {         function example() {         }         return example;     })();     mymodule.example = example; })(mymodule || (mymodule = {})); 

so can use modules in typescript make code less noisy.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -