make regular cyclist work in the background

+ use worker-timers in Repl
+ repl / cyclist now accept custom interval functions
This commit is contained in:
Felix Roos 2024-03-22 01:01:17 +01:00
parent 7889017434
commit 14a5e7dcb6
5 changed files with 51 additions and 6 deletions

View file

@ -37,6 +37,7 @@ import { prebake } from './prebake.mjs';
import { getRandomTune, initCode, loadModules, shareCode, ReplContext } from './util.mjs';
import PlayCircleIcon from '@heroicons/react/20/solid/PlayCircleIcon';
import './Repl.css';
import { setInterval, clearInterval } from 'worker-timers';
const { latestCode } = settingsMap.get();
@ -75,6 +76,8 @@ export function Repl({ embedded = false }) {
sync: false,
defaultOutput: webaudioOutput,
getTime: () => getAudioContext().currentTime,
setInterval,
clearInterval,
transpiler,
autodraw: false,
root: containerRef.current,