ultralight-godot SHOWCASEshabbywu/ultralight-godot

API / CLASS REFERENCE

UltralightTask

Inherits: RefCounted

Single-completion asynchronous operation with a retained result.

Check is_completed before awaiting completed because an operation may finish synchronously. Read get_result afterwards; the result remains available. Only the first terminal operation takes effect. Cancel stops this observation or delivery without undoing business side effects or forcibly terminating a JavaScript Promise. Public resolve/reject are used by register_async handlers.

Methods

is_completed

is_completed() → bool const

Return whether a terminal result is retained.

get_result

get_result() → UltralightResult const

Return the retained result, or null before completion.

resolve

resolve(value: Variant = null) → void

Complete a host async request successfully. Repeated completion is ignored. Main thread only.

reject

reject(code: String, message: String) → void

Complete a host async request with the provided error code and message. Main thread only.

cancel

cancel() → void

Complete with Cancelled if still pending. Does not undo already executed operations. Main thread only.

Signals

completed

completed()

Emitted once when the task reaches its terminal state. Check is_completed before awaiting, then call get_result.

View class documentation source ↗

Godot screenshot · Press Esc to close Open original image ↗