client.projects.wait(...) or client.exports.wait(...) and only reach for client.tasks.* when they need low-level task inspection.
client.tasks.get(taskId, options?)
Fetch the current state of a task by ID.
Task statuses
client.tasks.wait(taskId, options?)
Poll a task until it reaches a terminal state. Returns the final task on success, throws YoukaTaskError on failure.
Options
number
Milliseconds between polls. Defaults to
2000.AbortSignal
Abort the wait. The in-flight request and any pending delay are cancelled
immediately.
Errors
client.tasks.wait(...) throws YoukaTaskError when the task ends in failed, cancelled, or timed-out:
client.projects.wait(operation, options?)
Wait for a project-scoped operation to finish, then refetch the project. Returns the operation handle, the terminal task, and the updated project.
ProjectOperation
required
Usually the result of
client.projects.create(...),
client.projects.separateStems(...), or client.projects.syncLyrics(...).client.exports.wait(operationOrId, options?)
Wait for a cloud export to reach a terminal state. Pass either the ExportOperation returned by client.exports.create(...) or an exportId string.
Cancellation
Pass anAbortSignal to cancel a long-running wait:
What’s next
- Errors — handle
YoukaTaskErrorand retryable errors - Exports — wait for an export to finish
- API async jobs — the same pattern in raw HTTP
