reset for example patterns

This commit is contained in:
Jade (Rose) Rowland 2024-01-08 10:49:26 -05:00
parent e01c6dc18d
commit 78f6fdf169
3 changed files with 14 additions and 66 deletions

View file

@ -164,7 +164,17 @@ export function Repl({ embedded = false }) {
editorRef.current?.toggle();
};
const handleUpdate = (id, code) => {
const resetEditor = async () => {
clearCanvas();
resetLoadedSounds();
editorRef.current.repl.setCps(1);
await prebake(); // declare default samples
};
const handleUpdate = async (id, code, reset = false) => {
if (reset) {
await resetEditor();
}
setViewingPattern(id);
editorRef.current.setCode(code);
};