ultralight-godot SHOWCASEshabbywu/ultralight-godot

API / CLASS REFERENCE

UltralightJSValue

Inherits: RefCounted

Document-scoped handle for checked JavaScript access.

Use handles only on the Godot main thread and in the document which created them. Access methods return UltralightResult. Nested arrays and objects stay live; snapshot creates independent Godot containers. close releases the handle and affects aliases sharing it. Navigation or binding revocation invalidates the handle. Snapshot traversal rejects cycles and nesting deeper than 64 levels.

Methods

get_value

get_value(key: Variant) → UltralightResult

Read an indexed or named property using shared conversion.

set_value

set_value(key: Variant, value: Variant) → UltralightResult

Write an indexed or named property. Enforce the source container and read-only constraints.

utf8_bytes

utf8_bytes() → UltralightResult

Convert the retained value to UTF-8 bytes in a successful PackedByteArray result. Preserves embedded NUL bytes which Godot String cannot represent.

snapshot

snapshot() → UltralightResult

Create an independent recursive copy of supported data. Reject cycles and depth over 64.

keys

keys() → UltralightResult

Return own enumerable keys in the successful result.

size

size() → int

Return array length or own enumerable key count. Return -1 when closed or access fails; zero is a valid empty collection.

append

append(value: Variant) → UltralightResult

Append a value to an Array using shared conversion.

remove

remove(key: Variant) → UltralightResult

Delete a property using JavaScript delete semantics. Array indices are not shifted. Return a failed result when the property is not configurable.

invoke_method

invoke_method(name: String, arguments: Array) → UltralightResult

Call the named function with this object as its receiver.

invoke

invoke(arguments: Array) → UltralightResult

Call a retained function with the supplied argument Array.

close

close() → void

Release this retained value and invalidate aliases of the same handle.

is_closed

is_closed() → bool const

Return whether explicitly closed or its document or binding has expired.

View class documentation source ↗

Godot screenshot · Press Esc to close Open original image ↗