title: Accessing class/subclass functions and properties from inside event handlers
body: <p>(This is something of a follow up from <a href="https://stackoverflow.com/questions/55983396/can-a-child-class-respond-to-events-captured-by-its-super">this question</a>, but I've included all necessary context here.)</p>
  
  <p>I am trying to create a system of HTML interface elements which will use a lot of shared code, and I'm having trouble dealing with event handlers and scope. This code is working:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>class Inator {
    constructor(whichCanvas, eventRegistry) {
      this.myCanvas = whichCanvas;
      this.foo = 10;
      for (var e in eventRegistry) {
        this.myCanvas.addEventListener(e,eventRegistry[e]);
      }
    }
    double(val) {
     return val*2;
    }
  }
  
  class Ballgowninator extends Inator {
    constructor(whichCanvas) {
      super(
       whichCanvas, {
          mousedown: (e) =&gt; {
            alert("mousedown");
          },
          mouseup: (e) =&gt; {
            alert("mouseup");
          }
        }
      );
      this.bar = 20;
    }
    triple(val) {
      return val*3;
    }
  }
  
  var c = new Ballgowninator(document.querySelector(".ballgown"));</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.inator {
    background-color: white;
    border: solid 1px black;
    width: 90vw;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;canvas class="ballgown inator"&gt;&lt;/canvas&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>(<a href="https://jsfiddle.net/TobyRush/1xjcmy4v/36/" rel="nofollow noreferrer">Same code</a> as a JSFiddle, if you prefer)</p>
  
  <p>However, I'd like to be able to access <code>double()</code>, <code>triple()</code>, <code>foo</code> and <code>bar</code> from inside the event handlers that I'm passing to <code>super()</code>. Is this even possible with the set up I have, or is there a better way to rework this entire approach?</p>
  
  <p>Thank you!</p>