JS Object¶
Wrappers for JavaScript values and object types exposed through V8.
Value
¶
Generic JavaScript value wrapper.
kind: str
property
¶
Return this value's V8 kind name.
__add__(other: _JSValueLike) -> Value
¶
Apply JavaScript addition.
__and__(other: _JSValueLike) -> Value
¶
Apply JavaScript bitwise and.
__await__() -> Generator[object, None, Value]
¶
Await this value when it is a JavaScript Promise.
__bool__() -> bool
¶
Return JavaScript truthiness for this value.
__call__(*args: _JSValueLike) -> Value
¶
Call this value with positional arguments.
__contains__(key: _JSValueLike) -> bool
¶
Return whether this value's object form has a property.
__delitem__(key: _JSValueLike) -> None
¶
Delete an object property.
__eq__(other: _JSValueLike) -> bool
¶
Apply JavaScript loose equality.
__float__() -> float
¶
Convert this numeric value to a Python float.
__ge__(other: _JSValueLike) -> bool
¶
Apply JavaScript greater-than-or-equal comparison.
__getitem__(key: _JSValueLike) -> Value
¶
Read an object property.
__gt__(other: _JSValueLike) -> bool
¶
Apply JavaScript greater-than comparison.
__int__() -> int
¶
Convert this numeric or BigInt value to a Python int.
__invert__() -> Value
¶
Apply JavaScript bitwise not.
__le__(other: _JSValueLike) -> bool
¶
Apply JavaScript less-than-or-equal comparison.
__len__() -> int
¶
Return this value's natural length.
__lshift__(other: _JSValueLike) -> Value
¶
Apply JavaScript left shift.
__lt__(other: _JSValueLike) -> bool
¶
Apply JavaScript less-than comparison.
__mod__(other: _JSValueLike) -> Value
¶
Apply JavaScript remainder.
__mul__(other: _JSValueLike) -> Value
¶
Apply JavaScript multiplication.
__ne__(other: _JSValueLike) -> bool
¶
Apply JavaScript loose inequality.
__neg__() -> Value
¶
Apply JavaScript unary negation.
__or__(other: _JSValueLike) -> Value
¶
Apply JavaScript bitwise or.
__pos__() -> Value
¶
Apply JavaScript unary plus.
__pow__(exponent: _JSValueLike, modulo: None = None) -> Value
¶
Apply JavaScript exponentiation.
__radd__(other: _JSValueLike) -> Value
¶
Apply JavaScript reflected addition.
__rand__(other: _JSValueLike) -> Value
¶
Apply JavaScript reflected bitwise and.
__repr__() -> str
¶
Return a debug representation.
__rlshift__(other: _JSValueLike) -> Value
¶
Apply JavaScript reflected left shift.
__rmod__(other: _JSValueLike) -> Value
¶
Apply JavaScript reflected remainder.
__rmul__(other: _JSValueLike) -> Value
¶
Apply JavaScript reflected multiplication.
__ror__(other: _JSValueLike) -> Value
¶
Apply JavaScript reflected bitwise or.
__rpow__(base: _JSValueLike, modulo: None = None) -> Value
¶
Apply JavaScript reflected exponentiation.
__rrshift__(other: _JSValueLike) -> Value
¶
Apply JavaScript reflected right shift.
__rshift__(other: _JSValueLike) -> Value
¶
Apply JavaScript right shift.
__rsub__(other: _JSValueLike) -> Value
¶
Apply JavaScript reflected subtraction.
__rtruediv__(other: _JSValueLike) -> Value
¶
Apply JavaScript reflected division.
__rxor__(other: _JSValueLike) -> Value
¶
Apply JavaScript reflected bitwise xor.
__setitem__(key: _JSValueLike, value: _JSValueLike) -> None
¶
Set an object property.
__str__() -> str
¶
Convert this value using JavaScript's string conversion.
__sub__(other: _JSValueLike) -> Value
¶
Apply JavaScript subtraction.
__truediv__(other: _JSValueLike) -> Value
¶
Apply JavaScript division.
__xor__(other: _JSValueLike) -> Value
¶
Apply JavaScript bitwise xor.
as_array() -> list[object] | None
¶
Convert this array value to a Python object.
as_big_int() -> int | None
¶
Return this value as a Python int if it is a BigInt.
as_big_int_i64() -> int | None
¶
Return this BigInt as i64 when the conversion is lossless.
as_big_int_string() -> str | None
¶
Return this BigInt as a decimal string.
as_boolean() -> bool | None
¶
Return this value as bool if it is a JavaScript boolean.
as_date() -> Date | None
¶
Return this value as a Date wrapper.
as_external() -> External | None
¶
Return this value as an External wrapper.
as_function() -> dict[str, str] | None
¶
Convert this function value to a Python object.
as_int32() -> int | None
¶
Return this value as i32 if it is an Int32.
as_map() -> Map | None
¶
Return this value as a Map wrapper.
as_number() -> float | None
¶
Return this value as f64 if it is a JavaScript number.
as_object() -> dict[object, object] | None
¶
Convert this object value to a Python object.
as_proxy() -> Proxy | None
¶
Return this value as a Proxy wrapper.
as_regexp() -> RegExp | None
¶
Return this value as a RegExp wrapper.
as_set() -> Set | None
¶
Return this value as a Set wrapper.
as_uint32() -> int | None
¶
Return this value as u32 if it is a Uint32.
as_v8_array() -> Array | None
¶
Return this value as an Array wrapper.
as_v8_array_buffer() -> ArrayBuffer | None
¶
Return this value as an ArrayBuffer wrapper.
as_v8_array_buffer_view() -> ArrayBufferView | None
¶
Return this value as an ArrayBufferView wrapper.
as_v8_big_int() -> BigInt | None
¶
Return this value as a BigInt wrapper.
as_v8_data_view() -> DataView | None
¶
Return this value as a DataView wrapper.
as_v8_date() -> Date | None
¶
Return this value as a Date wrapper.
as_v8_external() -> External | None
¶
Return this value as an External wrapper.
as_v8_function() -> Function | None
¶
Return this value as a Function wrapper.
as_v8_map() -> Map | None
¶
Return this value as a Map wrapper.
as_v8_object() -> Object | None
¶
Return this value as an Object wrapper.
as_v8_promise() -> Promise | None
¶
Return this value as a Promise wrapper.
as_v8_proxy() -> Proxy | None
¶
Return this value as a Proxy wrapper.
as_v8_regexp() -> RegExp | None
¶
Return this value as a RegExp wrapper.
as_v8_set() -> Set | None
¶
Return this value as a Set wrapper.
as_v8_string() -> String | None
¶
Return this value as a String wrapper.
as_v8_symbol() -> Symbol | None
¶
Return this value as a Symbol wrapper.
as_v8_typed_array() -> TypedArray | None
¶
Return this value as a TypedArray wrapper.
as_v8_wasm_module() -> WasmModule | None
¶
Return this value as a WasmModule wrapper.
as_wasm_module() -> WasmModule | None
¶
Return this value as a WasmModule wrapper.
call(args: _JSFunctionArgsLike | None = None, this_arg: _JSValueLike | None = None) -> Value
¶
Call this value when it is a JavaScript function.
define_own_property(key: _JSPropertyNameLike, value: _JSValueLike, attributes: PropertyAttribute | None = None, *, read_only: bool = False, dont_enum: bool = False, dont_delete: bool = False) -> bool
¶
Define an own data property with optional V8 attributes.
define_property(key: _JSPropertyNameLike, descriptor: PropertyDescriptor) -> bool
¶
Define a property using a full property descriptor.
delete(key: _JSValueLike) -> bool
¶
Delete an object property after converting this value to an object.
delete_private(key: Private) -> bool
¶
Delete a private property.
freeze() -> bool
¶
Freeze this object value.
get(key: _JSValueLike) -> Value
¶
Read an object property after converting this value to an object.
get_index(index: int) -> Value
¶
Read an indexed object property.
get_internal_field(index: int) -> Value | Private | None
¶
Return an internal field value.
get_own_property_descriptor(key: _JSPropertyNameLike) -> PropertyDescriptor | None
¶
Return the own property descriptor for a key.
get_private(key: Private) -> Value
¶
Read a private property.
get_property_attributes(key: _JSValueLike) -> PropertyAttribute
¶
Return V8 property attributes for a key.
has(key: _JSValueLike) -> bool
¶
Return whether this value's object form has a property.
has_private(key: Private) -> bool
¶
Return whether a private property exists.
instance_of(constructor: Value) -> bool
¶
Evaluate JavaScript instanceof against a constructor value.
internal_field_count() -> int
¶
Return the number of internal fields on this value's object form.
is_array() -> bool
¶
Return whether this value is an array.
is_array_buffer() -> bool
¶
Return whether this value is an ArrayBuffer.
is_array_buffer_view() -> bool
¶
Return whether this value is an ArrayBufferView, TypedArray, or DataView.
is_big_int() -> bool
¶
Return whether this value is a BigInt.
is_boolean() -> bool
¶
Return whether this value is a boolean.
is_callable() -> bool
¶
Return whether this value can be called as a function.
is_data_view() -> bool
¶
Return whether this value is a DataView.
is_date() -> bool
¶
Return whether this value is a Date.
is_error() -> bool
¶
Return whether this value is a native JavaScript Error object.
is_external() -> bool
¶
Return whether this value is an External.
is_function() -> bool
¶
Return whether this value is a function.
is_int32() -> bool
¶
Return whether this value is an Int32.
is_map() -> bool
¶
Return whether this value is a Map.
is_null() -> bool
¶
Return whether this value is JavaScript null.
is_number() -> bool
¶
Return whether this value is a JavaScript number.
is_object() -> bool
¶
Return whether this value is object-like.
is_promise() -> bool
¶
Return whether this value is a Promise.
is_proxy() -> bool
¶
Return whether this value is a Proxy.
is_regexp() -> bool
¶
Return whether this value is a RegExp.
is_set() -> bool
¶
Return whether this value is a Set.
is_string() -> bool
¶
Return whether this value is a string.
is_symbol() -> bool
¶
Return whether this value is a symbol.
is_typed_array() -> bool
¶
Return whether this value is a TypedArray.
is_uint32() -> bool
¶
Return whether this value is a Uint32.
is_undefined() -> bool
¶
Return whether this value is JavaScript undefined.
is_wasm_module() -> bool
¶
Return whether this value is a WebAssembly.Module object.
keys() -> list[object]
¶
Return this object's own property names.
length() -> int | None
¶
Return this value's natural length when it has one.
promise_result() -> Value | None
¶
Return the settled promise result, or None when pending or not a Promise.
promise_state() -> str | None
¶
Return the promise state when this value is a Promise.
same_value(other: Value) -> bool
¶
Compare this value with JavaScript SameValue semantics.
seal() -> bool
¶
Seal this object value.
set(key: _JSValueLike, value: _JSValueLike) -> bool
¶
Set an object property after converting this value to an object.
set_index(index: int, value: _JSValueLike) -> bool
¶
Set an indexed object property.
set_integrity_level(level: str) -> bool
¶
Set this object's integrity level to "sealed" or "frozen".
set_internal_field(index: int, data: object) -> bool
¶
Set an internal field value.
set_private(key: Private, value: _JSValueLike) -> bool
¶
Set a private property.
strict_equals(other: Value) -> bool
¶
Compare this value with JavaScript strict equality.
to_json() -> str | None
¶
Serialize this value with JSON.stringify.
to_python() -> object
¶
Convert this JavaScript value to a Python object.
to_string() -> str
¶
Convert this value using JavaScript's string conversion.
typeof() -> str
¶
Return JavaScript typeof for this value.
String
¶
Object
¶
JavaScript Object wrapper.
internal_field_count: int
property
¶
Return the number of internal fields on this object.
__contains__(key: _JSValueLike) -> bool
¶
Return whether this object has a property.
__delitem__(key: _JSValueLike) -> None
¶
Delete an object property.
__getitem__(key: _JSValueLike) -> Value
¶
Read an object property.
__len__() -> int
¶
Return the number of own property names.
__setitem__(key: _JSValueLike, value: _JSValueLike) -> None
¶
Set an object property.
define_own_property(key: _JSPropertyNameLike, value: _JSValueLike, attributes: PropertyAttribute | None = None, *, read_only: bool = False, dont_enum: bool = False, dont_delete: bool = False) -> bool
¶
Define an own data property with optional V8 attributes.
define_property(key: _JSPropertyNameLike, descriptor: PropertyDescriptor) -> bool
¶
Define a property using a full property descriptor.
delete(key: _JSValueLike) -> bool
¶
Delete an object property.
delete_private(key: Private) -> bool
¶
Delete a private property.
freeze() -> bool
¶
Freeze this object.
get(key: _JSValueLike) -> Value
¶
Read an object property.
get_internal_field(index: int) -> Value | Private | None
¶
Return an internal field value.
get_own_property_descriptor(key: _JSPropertyNameLike) -> PropertyDescriptor | None
¶
Return the own property descriptor for a key.
get_private(key: Private) -> Value
¶
Read a private property.
get_property_attributes(key: _JSValueLike) -> PropertyAttribute
¶
Return V8 property attributes for a key.
has(key: _JSValueLike) -> bool
¶
Return whether this object has a property.
has_private(key: Private) -> bool
¶
Return whether a private property exists.
keys() -> list[object]
¶
Return this object's own property names.
seal() -> bool
¶
Seal this object.
set(key: _JSValueLike, value: _JSValueLike) -> bool
¶
Set an object property.
set_integrity_level(level: str) -> bool
¶
Set this object's integrity level to "sealed" or "frozen".
set_internal_field(index: int, data: object) -> bool
¶
Set an internal field value.
set_private(key: Private, value: _JSValueLike) -> bool
¶
Set a private property.
to_value() -> Value
¶
Return this object as a generic V8 Value.
Array
¶
JavaScript Array wrapper.
__getitem__(index: int) -> Value
¶
Read an array element.
__len__() -> int
¶
Return the array length.
__setitem__(index: int, value: _JSValueLike) -> None
¶
Set an array element.
get(index: int) -> Value
¶
Read an array element.
length() -> int
¶
Return the array length.
set(index: int, value: _JSValueLike) -> bool
¶
Set an array element.
to_value() -> Value
¶
Return this array as a generic V8 Value.
Function
¶
JavaScript Function wrapper.
cached_data_rejected: bool
property
¶
Return whether supplied cached data was rejected by V8.
name: str
property
¶
Return the JavaScript function name.
resource_name: str | None
property
¶
Return the function's resource name.
script_column_number: int | None
property
¶
Return the script column number for this function.
script_id: int
property
¶
Return V8's script id for this function.
script_line_number: int | None
property
¶
Return the script line number for this function.
source_map_url: str | None
property
¶
Return the function's source map URL.
__call__(*args: _JSValueLike) -> Value
¶
Call this JavaScript function with positional arguments.
call(args: _JSFunctionArgsLike | None = None, this_arg: _JSValueLike | None = None) -> Value
¶
Call this JavaScript function.
create_code_cache() -> bytes
¶
Create V8 code-cache bytes for this function.
to_value() -> Value
¶
Return this function as a generic V8 Value.
Promise
¶
JavaScript Promise wrapper.
Map
¶
JavaScript Map wrapper.
size: int
property
¶
Return the number of Map entries.
__contains__(key: _JSValueLike) -> bool
¶
Return whether the Map contains a key.
__delitem__(key: _JSValueLike) -> None
¶
Delete a Map entry.
__getitem__(key: _JSValueLike) -> Value
¶
Return the value for a Map key.
__iter__() -> Iterator[Value]
¶
Iterate over Map keys.
__len__() -> int
¶
Return the number of Map entries.
__setitem__(key: _JSValueLike, value: _JSValueLike) -> None
¶
Set a Map entry.
clear() -> None
¶
Remove all entries from the Map.
delete(key: _JSValueLike) -> bool
¶
Delete a Map entry.
entries() -> list[tuple[Value, Value]]
¶
Return Map entries as key-value pairs.
get(key: _JSValueLike) -> Value
¶
Return the value for a Map key.
has(key: _JSValueLike) -> bool
¶
Return whether the Map contains a key.
items() -> list[tuple[Value, Value]]
¶
Return Map entries as key-value pairs.
keys() -> list[Value]
¶
Return Map keys.
set(key: _JSValueLike, value: _JSValueLike) -> bool
¶
Set a Map entry.
to_value() -> Value
¶
Return this Map as a generic V8 Value.
values() -> list[Value]
¶
Return Map values.
Set
¶
JavaScript Set wrapper.
size: int
property
¶
Return the number of Set entries.
__contains__(value: _JSValueLike) -> bool
¶
Return whether the Set contains a value.
__iter__() -> Iterator[Value]
¶
Iterate over Set values.
__len__() -> int
¶
Return the number of Set entries.
add(value: _JSValueLike) -> bool
¶
Add a value to the Set.
clear() -> None
¶
Remove all entries from the Set.
delete(value: _JSValueLike) -> bool
¶
Delete a value from the Set.
entries() -> list[Value]
¶
Return Set values in iteration order.
has(value: _JSValueLike) -> bool
¶
Return whether the Set contains a value.
keys() -> list[Value]
¶
Return Set values.
to_value() -> Value
¶
Return this Set as a generic V8 Value.
values() -> list[Value]
¶
Return Set values.
Date
¶
JavaScript Date wrapper.
timestamp_ms: float
property
¶
Return milliseconds since the Unix epoch.
__float__() -> float
¶
Return milliseconds since the Unix epoch.
__str__() -> str
¶
Return JavaScript's string representation for this Date.
timestamp() -> float
¶
Return seconds since the Unix epoch.
to_datetime() -> datetime
¶
Convert this Date to a timezone-aware Python datetime.
to_value() -> Value
¶
Return this Date as a generic V8 Value.
value_of() -> float
¶
Return milliseconds since the Unix epoch.
RegExp
¶
JavaScript RegExp wrapper.
flags: str
property
¶
Return the RegExp flags.
source: str
property
¶
Return the RegExp source pattern.
__str__() -> str
¶
Return JavaScript's string representation for this RegExp.
exec(subject: str) -> Object | None
¶
Execute this RegExp against a subject string.
test(subject: str) -> bool
¶
Return whether this RegExp matches a subject string.
to_value() -> Value
¶
Return this RegExp as a generic V8 Value.
Proxy
¶
JavaScript Proxy wrapper.
__str__() -> str
¶
Return JavaScript's string representation for this Proxy.
handler() -> Value
¶
Return the proxy handler object.
is_revoked() -> bool
¶
Return whether this proxy has been revoked.
revoke() -> None
¶
Revoke this proxy when this wrapper owns the revocation capability.
target() -> Value
¶
Return the proxy target object.
to_value() -> Value
¶
Return this Proxy as a generic V8 Value.
BigInt
¶
Symbol
¶
ArrayBuffer
¶
JavaScript ArrayBuffer wrapper.
byte_length: int
property
¶
Return the byte length.
__bytes__() -> bytes
¶
Return this ArrayBuffer as Python bytes.
__len__() -> int
¶
Return the byte length.
as_uint8_array(byte_offset: int = 0, length: int | None = None) -> TypedArray
¶
Create a Uint8Array view over this ArrayBuffer.
copy_contents() -> bytes
¶
Copy this ArrayBuffer into Python bytes.
data_view(byte_offset: int = 0, byte_length: int | None = None) -> DataView
¶
Create a DataView over this ArrayBuffer.
detach() -> bool
¶
Detach this ArrayBuffer.
is_detachable() -> bool
¶
Return whether this ArrayBuffer can be detached.
memoryview() -> memoryview
¶
Return a Python memoryview over copied bytes.
to_bytes() -> bytes
¶
Copy this ArrayBuffer into Python bytes.
to_value() -> Value
¶
Return this ArrayBuffer as a generic V8 Value.
typed_array(kind: str = 'Uint8Array', byte_offset: int = 0, length: int | None = None) -> TypedArray
¶
Create a TypedArray view over this ArrayBuffer.
was_detached() -> bool
¶
Return whether this ArrayBuffer has been detached.
ArrayBufferView
¶
JavaScript ArrayBufferView wrapper.
byte_length: int
property
¶
Return the view byte length.
byte_offset: int
property
¶
Return the byte offset into the backing ArrayBuffer.
__bytes__() -> bytes
¶
Return this view as Python bytes.
__len__() -> int
¶
Return the view byte length.
buffer() -> ArrayBuffer
¶
Return the backing ArrayBuffer.
copy_contents() -> bytes
¶
Copy this view into Python bytes.
has_buffer() -> bool
¶
Return whether this view has a backing buffer.
memoryview() -> memoryview
¶
Return a Python memoryview over copied bytes.
to_bytes() -> bytes
¶
Copy this view into Python bytes.
to_value() -> Value
¶
Return this view as a generic V8 Value.
TypedArray
¶
JavaScript TypedArray wrapper.
byte_length: int
property
¶
Return the byte length.
byte_offset: int
property
¶
Return the byte offset into the backing ArrayBuffer.
length: int
property
¶
Return the element length.
type_name: str
property
¶
Return the JavaScript typed array constructor name.
__bytes__() -> bytes
¶
Return this TypedArray as Python bytes.
__len__() -> int
¶
Return the element length.
buffer() -> ArrayBuffer
¶
Return the backing ArrayBuffer.
copy_contents() -> bytes
¶
Copy this TypedArray into Python bytes.
memoryview() -> memoryview
¶
Return a Python memoryview over copied bytes.
to_bytes() -> bytes
¶
Copy this TypedArray into Python bytes.
to_value() -> Value
¶
Return this TypedArray as a generic V8 Value.
DataView
¶
JavaScript DataView wrapper.
byte_length: int
property
¶
Return the DataView byte length.
byte_offset: int
property
¶
Return the byte offset into the backing ArrayBuffer.
__bytes__() -> bytes
¶
Return this DataView as Python bytes.
__len__() -> int
¶
Return the DataView byte length.
buffer() -> ArrayBuffer
¶
Return the backing ArrayBuffer.
copy_contents() -> bytes
¶
Copy this DataView into Python bytes.
memoryview() -> memoryview
¶
Return a Python memoryview over copied bytes.
to_bytes() -> bytes
¶
Copy this DataView into Python bytes.
to_value() -> Value
¶
Return this DataView as a generic V8 Value.
Private
¶
External
¶
V8 External wrapper that can carry a Python-owned payload.
id: int | None
property
¶
Return the runtime-managed payload id.
__repr__() -> str
¶
Return a debug representation.
is_managed() -> bool
¶
Return whether this external is managed by this runtime.
payload() -> object
¶
Return the Python payload stored in this external.
to_value() -> Value
¶
Return this external as a generic V8 Value.
WasmModule
¶
JavaScript WebAssembly.Module object wrapper.
source_url: str
property
¶
Return this module's source URL metadata.
wire_bytes: bytes
property
¶
Return this module's wire bytes.
__repr__() -> str
¶
Return a debug representation.
get_compiled_module() -> CompiledWasmModule
¶
Return the reusable compiled module handle.
to_value() -> Value
¶
Return this module as a generic V8 Value.
CompiledWasmModule
¶
Reusable compiled WebAssembly module handle.
WasmModuleCache
¶
Cache of compiled WebAssembly modules keyed by their wire bytes.
hits: int
property
¶
Return the number of cache hits.
misses: int
property
¶
Return the number of cache misses.
stores: int
property
¶
Return the number of modules stored in the cache.
__bool__() -> bool
¶
Return whether this cache contains any modules.
__contains__(wire_bytes: object) -> bool
¶
Return whether the cache contains a module for the given bytes-like key.
__len__() -> int
¶
Return the number of cached modules.
__new__() -> WasmModuleCache
¶
Create an empty WebAssembly module cache.
__repr__() -> str
¶
Return a debug representation.
clear() -> None
¶
Remove all cached modules while keeping hit and miss counters.
contains(wire_bytes: bytes | bytearray | memoryview) -> bool
¶
Return whether the cache contains a module for the given wire bytes.
insert(module: WasmModule) -> None
¶
Insert a compiled module from an existing WasmModule object.
PropertyAttribute
¶
V8 object property attribute bits.
bits: int
property
¶
Return the raw V8 attribute bits.
configurable: bool
property
¶
Return whether the property is configurable.
dont_delete: bool
property
¶
Return whether the property cannot be deleted.
dont_enum: bool
property
¶
Return whether the property is excluded from enumeration.
enumerable: bool
property
¶
Return whether the property is enumerable.
read_only: bool
property
¶
Return whether the property is read-only.
writable: bool
property
¶
Return whether the property is writable.
__new__(*, read_only: bool = False, dont_enum: bool = False, dont_delete: bool = False) -> PropertyAttribute
¶
Create property attributes from boolean flags.
__or__(other: PropertyAttribute) -> PropertyAttribute
¶
Combine two attribute sets.
__repr__() -> str
¶
Return a debug representation.
dont_delete_attribute() -> PropertyAttribute
staticmethod
¶
Return the dont-delete attribute.
dont_enum_attribute() -> PropertyAttribute
staticmethod
¶
Return the dont-enum attribute.
is_none() -> bool
¶
Return whether no attribute flags are set.
none() -> PropertyAttribute
staticmethod
¶
Return an attribute set with no flags.
read_only_attribute() -> PropertyAttribute
staticmethod
¶
Return the read-only attribute.
PropertyDescriptor
¶
ECMAScript property descriptor used by Object.defineProperty.
configurable: bool | None
property
¶
Return the configurable flag.
enumerable: bool | None
property
¶
Return the enumerable flag.
get: _JSAccessorLike | None
property
¶
Return the getter function.
set: _JSAccessorLike | None
property
¶
Return the setter function.
value: _JSValueLike | None
property
¶
Return the descriptor value.
writable: bool | None
property
¶
Return the writable flag.
__new__(value: _JSValueLike | None = None, *, get: _JSAccessorLike | None = None, set: _JSAccessorLike | None = None, writable: bool | None = None, enumerable: bool | None = None, configurable: bool | None = None) -> PropertyDescriptor
¶
Create a property descriptor.
__repr__() -> str
¶
Return a debug representation.
accessor(*, get: _JSAccessorLike | None = None, set: _JSAccessorLike | None = None, enumerable: bool | None = None, configurable: bool | None = None) -> PropertyDescriptor
staticmethod
¶
Create an accessor descriptor.
data(value: _JSValueLike, *, writable: bool | None = None, enumerable: bool | None = None, configurable: bool | None = None) -> PropertyDescriptor
staticmethod
¶
Create a data descriptor.
has_configurable() -> bool
¶
Return whether this descriptor has a configurable flag.
has_enumerable() -> bool
¶
Return whether this descriptor has an enumerable flag.
has_get() -> bool
¶
Return whether this descriptor has a getter.
has_set() -> bool
¶
Return whether this descriptor has a setter.
has_value() -> bool
¶
Return whether this descriptor has a value field.
has_writable() -> bool
¶
Return whether this descriptor has a writable flag.
is_accessor_descriptor() -> bool
¶
Return whether this is an accessor descriptor.
is_data_descriptor() -> bool
¶
Return whether this is a data descriptor.
to_dict() -> dict[str, object]
¶
Convert this descriptor into a Python dict.