mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-16 08:08:27 +00:00
bring back promise cache
just in case loadWorklets is called more than once
This commit is contained in:
parent
ff85f2307f
commit
07f58c023f
@ -41,8 +41,12 @@ export const getAudioContext = () => {
|
||||
return audioContext;
|
||||
};
|
||||
|
||||
async function loadWorklets() {
|
||||
return await getAudioContext().audioWorklet.addModule(workletsUrl);
|
||||
let workletsLoading;
|
||||
function loadWorklets() {
|
||||
if (!workletsLoading) {
|
||||
workletsLoading = getAudioContext().audioWorklet.addModule(workletsUrl);
|
||||
}
|
||||
return workletsLoading;
|
||||
}
|
||||
|
||||
// this function should be called on first user interaction (to avoid console warning)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user