localize draw logic
This commit is contained in:
parent
d980c9ca4c
commit
1ac784dc7a
15 changed files with 397 additions and 308 deletions
|
|
@ -12,8 +12,8 @@ export function repl({
|
|||
afterEval,
|
||||
getTime,
|
||||
transpiler,
|
||||
editPattern,
|
||||
onToggle,
|
||||
drawContext,
|
||||
}) {
|
||||
const scheduler = new Cyclist({
|
||||
interval,
|
||||
|
|
@ -35,7 +35,7 @@ export function repl({
|
|||
getTime,
|
||||
onToggle,
|
||||
});
|
||||
setTime(() => scheduler.getPhase()); // TODO: refactor?
|
||||
setTime(() => scheduler.now()); // TODO: refactor?
|
||||
const evaluate = async (code, autostart = true) => {
|
||||
if (!code) {
|
||||
throw new Error('no code to evaluate');
|
||||
|
|
@ -45,7 +45,6 @@ export function repl({
|
|||
let { pattern } = await _evaluate(code, transpiler);
|
||||
|
||||
logger(`[eval] code updated`);
|
||||
pattern = editPattern?.(pattern) || pattern;
|
||||
scheduler.setPattern(pattern, autostart);
|
||||
afterEval?.({ code, pattern });
|
||||
return pattern;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue