Javascript "this" scope -


i writing javascript code. little confused keyword. how access logger variable in datareceivedhandler function?

myclass: {     logger: null,     init: function() {         logger = logfactory.getlogger();     },     loaddata: function() {         var datareceivedhandler = function() {             // how access logger variable here?          }          // more stuff     } }; 

assuming loaddata called so:

myclass.loaddata(); 

then:

loaddata: function() {     var self = this;     var datareceivedhandler = function() {         self.logger ...     }      // more stuff } 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -