fix nano-repl prod build

This commit is contained in:
Felix Roos 2022-08-23 18:23:36 +02:00
parent 11a9f3ced3
commit 4dfc34515c
2 changed files with 6 additions and 5 deletions

View File

@ -12,10 +12,11 @@ const createWorker = (func) => new Worker(urlifyFunction(func));
// this is just a setInterval with a counter, running in a worker
export class ClockWorker {
worker;
interval = 1 / 20; // query span, use powers of 2 to get better float accuracy
interval = 1 / 20; // query span, use divisors of 1000 to get better accuracy
tick = 0;
constructor(callback, interval = this.interval) {
this.interval = interval;
constructor(callback, interval) {
// for some reason the constructor default value won't do in prod build
this.interval = interval || this.interval;
this.worker = createWorker(() => {
// we cannot use closures here!
let interval;
@ -47,7 +48,7 @@ export class ClockWorker {
}
};
});
this.worker.postMessage({ interval });
this.setInterval(this.interval);
// const round = (n, d) => Math.round(n * d) / d;
this.worker.onmessage = (e) => {
if (e.data === 'tick') {

View File

@ -9,7 +9,7 @@ import './style.css';
// import { prebake } from '../../../../../repl/src/prebake.mjs';
// TODO: only import stuff when play is pressed?
await evalScope(
evalScope(
controls,
import('@strudel.cycles/core'),
// import('@strudel.cycles/tone'),