aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/audio.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/audio.js')
-rw-r--r--ext/bg/js/audio.js18
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;
}