> Discover all available pages from the documentation index: https://mastra.zisheng.pro/zh-HK/llms.txt # Workflow\.sleepUntil() `.sleepUntil()` 方法會暫停執行,直至指定日期。 ## 使用範例 ```typescript workflow.sleepUntil(new Date(Date.now() + 5000)) ``` ## 參數 **dateOrCallback** (`Date | ((params: ExecuteFunctionParams) => Promise)`): Date 物件或傳回 Date 的 callback function。callback 會接收執行 context,並可根據輸入資料動態計算目標時間。 ## 傳回值 **workflow** (`Workflow`): 用於串連方法的 Workflow 實例 ## 延伸使用範例 ```typescript import { createWorkflow, createStep } from "@mastra/core/workflows"; const step1 = createStep({...}); const step2 = createStep({...}); export const testWorkflow = createWorkflow({...}) .then(step1) .sleepUntil(async ({ inputData }) => { const { delayInMs } = inputData; return new Date(Date.now() + delayInMs); }) .then(step2) .commit(); ```