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
Post a Comment