How do i create instance-able objects inside of static objects in javascript? -


i know can make static objects inside of static objects, example:

aaa: {     bbb: {}     ccc: {} } 

but want make objects can have instantiated, that:

aaa: {     bbb = function(yyy): {         this.variable // 1 belong aaa(parent object) instead of instance of bbb     }     ccc = function(ooo) {     } } 

can done?

statics definition don't have 'this' reference addressing particular instance. can achieve you're trying this:

aaa: {     bbb: (function()      {         aaa.variable = 'something';     })(),      ccc:     {      } } 

note value of bbb here return value of (self executing) function (null). seems bit of odd way of doing things though, suggest reorgainising if possible


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -