Remove unnecessary promise wrappers

This commit is contained in:
Eric Rosenbaum 2019-01-14 15:37:02 -05:00
parent 29b2e7ebc7
commit aee73d97a5

View file

@ -156,7 +156,7 @@ class AudioEngine {
.catch(() => { .catch(() => {
// If the file is empty, create an empty sound // If the file is empty, create an empty sound
if (sound.data.length === 0) { if (sound.data.length === 0) {
return Promise.resolve(this._emptySound()); return this._emptySound();
} }
// The audio context failed to parse the sound data // The audio context failed to parse the sound data
@ -166,7 +166,7 @@ class AudioEngine {
const bufferCopy2 = sound.data.buffer.slice(0); const bufferCopy2 = sound.data.buffer.slice(0);
// Try decoding as adpcm // Try decoding as adpcm
return new ADPCMSoundDecoder(this.audioContext).decode(bufferCopy2) return new ADPCMSoundDecoder(this.audioContext).decode(bufferCopy2)
.catch(() => Promise.resolve(this._emptySound())); .catch(() => this._emptySound());
}) })
.then( .then(
buffer => ([soundId, buffer]), buffer => ([soundId, buffer]),