From 8244ba7754b8dbfc184a6f3e1acc6b9df5a3042e Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 7 Aug 2022 00:14:27 +0200 Subject: [PATCH] hotfix: prebake flag to skip fetch --- repl/src/prebake.mjs | 10 ++++++---- repl/src/runtime.mjs | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/repl/src/prebake.mjs b/repl/src/prebake.mjs index a6f33909..ef617621 100644 --- a/repl/src/prebake.mjs +++ b/repl/src/prebake.mjs @@ -1,7 +1,7 @@ import { Pattern, toMidi } from '@strudel.cycles/core'; import { samples } from '@strudel.cycles/webaudio'; -export function prebake() { +export function prebake(isMock = false) { samples( { piano: { @@ -41,9 +41,11 @@ export function prebake() { // License: CC-by http://creativecommons.org/licenses/by/3.0/ Author: Alexander Holm './piano/', ); - fetch('EmuSP12.json') - .then(res => res.json()) - .then(json => samples(json, './EmuSP12/')); + if (!isMock) { + fetch('EmuSP12.json') + .then((res) => res.json()) + .then((json) => samples(json, './EmuSP12/')); + } } const maxPan = toMidi('C8'); diff --git a/repl/src/runtime.mjs b/repl/src/runtime.mjs index b883cfc6..1802a7ad 100644 --- a/repl/src/runtime.mjs +++ b/repl/src/runtime.mjs @@ -123,7 +123,7 @@ const uiHelpersMocked = { backgroundImage: id, }; -prebake(); +prebake(true); // TODO: refactor to evalScope extend(