Use arrow functions

This commit is contained in:
Eric Rosenbaum 2017-06-21 11:23:32 -04:00
parent 43e0408434
commit 90af375b03

View file

@ -75,12 +75,11 @@ class SoundPlayer {
* @return {Promise} a Promise that resolves when the sound finishes playing * @return {Promise} a Promise that resolves when the sound finishes playing
*/ */
finished () { finished () {
const storedContext = this;
return new Promise(resolve => { return new Promise(resolve => {
storedContext.bufferSource.onended = function () { this.bufferSource.onended = () => {
this.isPlaying = false; this.isPlaying = false;
resolve(); resolve();
}.bind(storedContext); };
}); });
} }
} }