function KeyPressEmulation(keyboardEventUtil, sinon) {
  this._keyDownListeners = [];
  this._keyUpListeners = [];
  var self = this;
  sinon.stub(keyboardEventUtil, 'addKeyDownListener', function(fn) {
    self._keyDownListeners.push(fn);
  });
  sinon.stub(keyboardEventUtil, 'addKeyUpListener', function(fn) {
    self._keyUpListeners.push(fn);
  });
}
KeyPressEmulation.prototype = {
  keyDownByKeyName: function(keyName) {
    this._keyDownListeners[0](keyName);
  },

  keyUpByKeyName: function(keyName) {
    this._keyUpListeners[0](keyName);
  },

  keyDownByKeyNames: function(keyNames) {
    keyNames.forEach(this.keyDownByKeyName.bind(this));
  },

  keyUpByKeyNames: function(keyNames) {
    keyNames.forEach(this.keyUpByKeyName.bind(this));
  },

  pressByKeyNames: function(keyNames) {
    // The first key is (normally) the Meta key, don't fire keyUp yet,
    // fire it only at the end of it all.
    var firstKeyName = keyNames[0];
    this._keyDownListeners[0](firstKeyName);

    // Fire all keyDowns and keyUps.
    var self = this;
    keyNames.slice(1).forEach(function(key) {
      self._keyDownListeners[0](key);
      self._keyUpListeners[0](key);
    });

    this.keyUpByKeyName(firstKeyName);
  }

};

module.exports = {
  KeyPressEmulation: KeyPressEmulation
};

@@ -1,16 +1,20 @@
-function
+export class
  KeyPres
@@ -19,24 +19,40 @@
 essEmulation
+ %7B%0A  constructor
 (keyboardEve
@@ -68,16 +68,18 @@
 inon) %7B%0A
+  
   this._
@@ -103,16 +103,18 @@
 = %5B%5D;%0A  
+ 
+ 
 this._ke
@@ -134,33 +134,16 @@
 = %5B%5D;%0A  
-var self = this;%0A
   sinon.
@@ -188,39 +188,28 @@
 tener', 
-function(fn) %7B%0A    self
+(fn) =%3E this
 ._keyDow
@@ -227,24 +227,21 @@
 push(fn)
+)
 ;%0A  
-%7D);%0A
   sinon.
@@ -288,31 +288,20 @@
 r', 
-function(fn) %7B%0A    self
+(fn) =%3E this
 ._ke
@@ -325,49 +325,15 @@
 (fn)
+)
 ;%0A  %7D
-);%0A%7D%0AKeyPressEmulation.prototype = %7B
+%0A
 %0A  k
@@ -343,34 +343,24 @@
 ownByKeyName
-: function
 (keyName) %7B%0A
@@ -398,25 +398,24 @@
 eyName);%0A  %7D
-,
 %0A%0A  keyUpByK
@@ -420,26 +420,16 @@
 yKeyName
-: function
 (keyName
@@ -469,25 +469,24 @@
 eyName);%0A  %7D
-,
 %0A%0A  keyDownB
@@ -490,34 +490,24 @@
 wnByKeyNames
-: function
 (keyNames) %7B
@@ -520,32 +520,47 @@
 eyNames.forEach(
+(...args) =%3E %7B 
 this.keyDownByKe
@@ -564,34 +564,32 @@
 yKeyName
-.bind(thi
+(...arg
 s)
+%7D
 );%0A  %7D
-,
 %0A%0A  keyU
@@ -595,34 +595,24 @@
 UpByKeyNames
-: function
 (keyNames) %7B
@@ -633,16 +633,31 @@
 forEach(
+(...args) =%3E %7B 
 this.key
@@ -671,26 +671,24 @@
 Name
-.bind(thi
+(...arg
 s)
+%7D
 );%0A  %7D
-,
 %0A%0A  
@@ -706,18 +706,8 @@
 ames
-: function
 (key
@@ -951,29 +951,8 @@
 ps.%0A
-    var self = this;%0A
     
@@ -981,21 +981,16 @@
 ach(
-function
 (key)
+ =%3E
  %7B%0A 
@@ -990,28 +990,28 @@
  =%3E %7B%0A      
-self
+this
 ._keyDownLis
@@ -1036,12 +1036,12 @@
     
-self
+this
 ._ke
@@ -1120,68 +1120,5 @@
 %7D%0A%0A%7D
-;%0A%0Amodule.exports = %7B%0A  KeyPressEmulation: KeyPressEmulation%0A%7D;
 %0A

Make it an ES6 class and remove usage of self.