Quantcast
Viewing latest article 5
Browse Latest Browse All 38

Comment from DarrylHebbes

How would one go about setting the 'publicProperty' in the sub-module pattern from another method in the object. for example:
MyObject = function(){
  var util = {
    privateMethod: function(){ 
       obj.publicProperty = 10;  // <- Is this possible?
    };
  }
  var obj = {
    publicProperty:5,
    publicMethod:function(){ util.privateMethod(); };
  }
  // do my object attachment
  obj.util = util;
  return obj;
}(); // run it right away

Viewing latest article 5
Browse Latest Browse All 38

Trending Articles