mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-25 02:27:00 -06:00
Problem: app.scheduleTask(code, delay, true) queued the task and then
skipped it (eval_with_tasks: `if repeat { continue; }`), so repeating
tasks - what ScriptUI panels use for polling and refreshing - never ran.
One-shot tasks scheduled by handlers or in the Script Console never ran
either.
Fix: tasks live per script context (crates/script/src/tasks.rs) with a
due time. Frontends run the due ones every frame through the new
ScriptUi::run_tasks hook (the egui app does; agents and headless hosts
use the `script.runTasks` command). Script-host threads get a Tick
message, inline hosts (Script Console, web) run in their kept context.
A repeating task runs every `delay` ms until app.cancelTask, until it
throws (reported once, then cancelled), or until its owner goes: the
script's last window closing, or - for scripts without windows and the
console - the project being closed or replaced (ScriptUi::project_epoch).
Bounds: at least 50 ms between runs, at most 64 pending tasks per
script, one run per pass (no catch-up bursts), task code nested too
deeply is refused, the engine's loop and recursion limits apply. Ticks
only reach the hosts of the session that scheduled them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 lines
972 B
TOML
29 lines
972 B
TOML
[package]
|
|
name = "effectcraft-script"
|
|
description = "EffectCraft scripting: JavaScript (boa) with an After Effects-style object model (app, project, CompItem, Layer, Property…) over the engine's undoable commands"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
rust-version.workspace = true
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
effectcraft-engine = { workspace = true }
|
|
effectcraft-project = { workspace = true }
|
|
effectcraft-keyframe = { workspace = true }
|
|
effectcraft-time = { workspace = true }
|
|
effectcraft-render = { workspace = true }
|
|
effectcraft-path = { workspace = true }
|
|
serde_json = { workspace = true }
|
|
boa_engine = { workspace = true }
|
|
web-time = { workspace = true }
|
|
|
|
# On the web, boa's clock and Math.random need the browser (getrandom `wasm_js`, web-time).
|
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
|
boa_engine = { workspace = true, features = ["js"] }
|
|
|
|
[dev-dependencies]
|
|
effectcraft-expr = { workspace = true }
|