You need to specify the proper scope for the event listener, or specify a variable for this
outside the closure that you then access within the closure.
Option 1:
initImage: function(image){
image.element.on('swipe', function(e, node, options){
if (e.direction == "left"){
console.log("LEFT");
}else if (e.direction == "right"){
console.log("RIGHT");
}
console.log( this.getOrientationLabel().getHtml() );
}, this);
}
Option 2:
initImage: function(image){
var me = this;
image.element.on('swipe', function(e, node, options){
if (e.direction == "left"){
console.log("LEFT");
}else if (e.direction == "right"){
console.log("RIGHT");
}
console.log( me.getOrientationLabel().getHtml() );
});
}