Quantcast
Channel: Posts/rss
Viewing all articles
Browse latest Browse all 38

Comment from DarrylHebbes

$
0
0
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 all articles
Browse latest Browse all 38

Trending Articles