siglus_scene_vm/runtime/forms/
timewait.rs1use crate::runtime::{CommandContext, ProcKind, Value};
2use anyhow::Result;
3
4pub fn dispatch(ctx: &mut CommandContext, allow_key_skip: bool, args: &[Value]) -> Result<bool> {
5 let ms = args.first().and_then(|v| v.as_i64()).unwrap_or(0).max(0) as u64;
6 if ms == 0 {
7 if allow_key_skip {
10 ctx.push(Value::Int(0));
11 }
12 return Ok(true);
13 }
14
15 if allow_key_skip {
16 ctx.wait.wait_ms_key(ms);
17 } else {
18 ctx.wait.wait_ms(ms);
19 }
20 ctx.request_wait_proc_boundary(ProcKind::TimeWait);
21
22 Ok(true)
23}