MCPcopy Create free account
hub / github.com/botbotrobotics/BotBrain / executeWait

Function executeWait

frontend/src/hooks/useBlockProgramExecution.tsx:572–593  ·  view source on GitHub ↗
(seconds: number)

Source from the content-addressed store, hash-verified

570
571 // Execute wait command
572 const executeWait = async (seconds: number): Promise<void> => {
573 const startTime = Date.now();
574
575 return new Promise((resolve, reject) => {
576 const intervalId = setInterval(() => {
577 if (executionRef.current.abortController?.signal.aborted) {
578 clearInterval(intervalId);
579 reject(new Error('Execution aborted'));
580 return;
581 }
582
583 const elapsed = (Date.now() - startTime) / 1000;
584 const progress = Math.min((elapsed / seconds) * 100, 100);
585 setExecutionState(prev => ({ ...prev, progress }));
586
587 if (elapsed >= seconds) {
588 clearInterval(intervalId);
589 resolve();
590 }
591 }, UPDATE_INTERVAL);
592 });
593 };
594
595 // Execute robot action command (for stand up/down, lock/unlock)
596 const executeRobotAction = async (

Callers 1

executeBlockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected