diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-10-12 23:09:58 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-10-13 12:20:56 -0400 |
commit | 69b28571bdf8fb4c13198223e8a5668cf490840c (patch) | |
tree | 05fa8f0f0ba9f593ee746411e0a9e2c9a83ddd45 /ext/bg/js/audio.js | |
parent | 54d4c65854289de9d454198d7575d3db824cf0f1 (diff) |
audioBuildUrl => audioGetUrl and simplify
Diffstat (limited to 'ext/bg/js/audio.js')
-rw-r--r-- | ext/bg/js/audio.js | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/ext/bg/js/audio.js b/ext/bg/js/audio.js index 1a626d42..9508abf0 100644 --- a/ext/bg/js/audio.js +++ b/ext/bg/js/audio.js @@ -93,20 +93,14 @@ const audioUrlBuilders = { } }; -async function audioBuildUrl(definition, mode, optionsContext, cache={}) { - const cacheKey = `${mode}:${definition.expression}`; - if (cache.hasOwnProperty(cacheKey)) { - return Promise.resolve(cache[cacheKey]); - } - +async function audioGetUrl(definition, mode, optionsContext, download) { if (audioUrlBuilders.hasOwnProperty(mode)) { const handler = audioUrlBuilders[mode]; - return handler(definition, optionsContext).then( - (url) => { - cache[cacheKey] = url; - return url; - }, - () => null); + try { + return await handler(definition, optionsContext, download); + } catch (e) { + // NOP + } } return null; } |