I am trying to figure out how to remove the event listener in this scenario. Since I am calling a method from within the event listener function, I need to use ES6 syntax and can't use named functions. How can I go about removing the event listener?
methods :
initCanvas : function(x, y, width, height) {
//perform initialization tasks for canvas
},
some_method : function() {
let svgObjectEl = // logic to fetch the object element embedding the SVG
const loadEventHandler = () => {
// Retrieve values for x, y, width, height
// Do some operations here
this.initCanvas(x, y, width, height);
};
svgObjectEl.addEventListener('load', loadEventHandler);
//Need to remove the event listener but unsure how to do it
}