title: my `onevent` custom method does not work in my class
body: <p>I'm creating a class to manipulate a websocket...</p>
  
  <pre><code>class MySocket{
  
      construct(url){
          this.socket = new WebSocket(url);
      }
  
      onevent(name, fn){
          this.socket.addEventListener(name, fn);
      }
  
      send(data){
          this.socket.send(data);
      }
  
      close(){
          this.socket.close();
      }    
  }
  </code></pre>
  
  <p>Where I want to make a call to socket events <code>onopen | onclose | onmessage | onerror</code> in the style of Jquery...</p>
  
  <pre><code>const socket = new MySocket('ws://myurl');
  socket.onevent('open', function(e){
      this.send('Hello World');
  });
  socket.onevent('message', function(e){
      console.log(e.data);
      this.close();
  });
  </code></pre>
  
  <p>But it does not work.</p>