can now await initStrudel to get scheduler

This commit is contained in:
Felix Roos
2023-07-07 08:57:28 +02:00
parent cdf5456b75
commit 28b978f95f
+3 -1
View File
@@ -29,7 +29,7 @@ export async function defaultPrebake() {
let initDone;
let scheduler;
export function initStrudel(options = {}) {
export async function initStrudel(options = {}) {
initAudioOnFirstClick();
miniAllStrings();
const { prebake, ...schedulerOptions } = options;
@@ -39,6 +39,8 @@ export function initStrudel(options = {}) {
await prebake?.();
})();
scheduler = webaudioScheduler(schedulerOptions);
await initDone;
return { scheduler };
}
window.initStrudel = initStrudel;