I'm having issues updating errorlevel contextually as seen in the below example.
Code: Select all
var = moduleName {
error: false,
init: function() {
this.cacheDom();
this.bindEvents();
},
cacheDom: function() {
this.$someElement = $( 'someElement' );
},
bindEvents: function() {
this.$someElement.on( 'someEvent', this.someFunction.bind( this );
},
updateErrorLevel: function() {
// this.error = true; // << fails
// this.event.error = true; // << fails
moduleName.error = true; // << works
},
someFunction: function( event ) {
this.updateErrorLevel.call();
}
};
moduleName.init();
Thanks