mirror of
https://codeberg.org/uzu/strudel
synced 2026-08-02 21:52:32 -04:00
bring back promise cache
just in case loadWorklets is called more than once
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user