From 90af375b0335a43a77dd24f92a426b5a52c9dd0b Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Wed, 21 Jun 2017 11:23:32 -0400 Subject: [PATCH] Use arrow functions --- src/SoundPlayer.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/SoundPlayer.js b/src/SoundPlayer.js index 1a67b7f..ed73a78 100644 --- a/src/SoundPlayer.js +++ b/src/SoundPlayer.js @@ -75,12 +75,11 @@ class SoundPlayer { * @return {Promise} a Promise that resolves when the sound finishes playing */ finished () { - const storedContext = this; return new Promise(resolve => { - storedContext.bufferSource.onended = function () { + this.bufferSource.onended = () => { this.isPlaying = false; resolve(); - }.bind(storedContext); + }; }); } }