/ Published in: JavaScript
comparativa de diferentes patrones: http://www.klauskomenda.com/code/javascript-programming-patterns/
Expand |
Embed | Plain Text
var myAPP = function() { var private_var; var private_method = function(){ // do stuff here } return { public_method_1 : function() { // do stuff here }, public_method_2 : function() { // do stuff here } }; }(); // initialize the function myAPP.init(); //otra version var myAPP = function () { // set some configuation var config = {}; var init = function () { // set up the foundations }; // private function var anotherFuntion = function () { }; return { // set up which functions should be public init: init }; }(); // initialize the function myAPP.init();
You need to login to post a comment.
