I think this is a problem with the area, but I'm not sure how to fix it. Here is my code: http://jsfiddle.net/9k9Pe/1498/
class FrameCreator{ constructor(){ this.createFrame(); } createFrame(){ var iframe = document.createElement('iframe'); this.iframe = iframe; var frameLoaded=this.frameLoaded; iframe.onload = function () { frameLoaded(); }; document.body.appendChild(iframe); } frameLoaded(){ console.log("frame loaded"); } } class CustomFrameCreator extends FrameCreator{ addContent(){ console.log(this);
frameLoaded() prints undefined, and addContent prints the object.
How to fix it, so I can have a link in this case when loading a frame?
thanks
source share