IJsHostObjectHandler<TValue> Interface

The internal methods of a host exotic object created by IJsAdapter<TValue>.CreatePlatformObject (the legacy platform objects, https://webidl.spec.whatwg.org/#es-legacy-platform-objects). Each method returns true when it handled the operation; otherwise the adapter performs the ordinary internal method.

public interface IJsHostObjectHandler<TValue> where TValue : class

Type parameters

TValue

Properties

NameDescription
HasOrdinaryNonIndexPropertiesGets whether the internal methods are only exotic for the keys that are array indices (the object supports no named properties): the adapter may then perform the ordinary internal methods for the other keys without calling the handler.

HasOrdinaryNonIndexProperties

IJsAdapter.cs

Gets whether the internal methods are only exotic for the keys that are array indices (the object supports no named properties): the adapter may then perform the ordinary internal methods for the other keys without calling the handler.

public bool HasOrdinaryNonIndexProperties { get; }

Property value

bool

Methods

NameDescription
GetOwnKeys(TValue)[[OwnPropertyKeys]]: the keys that precede the ordinary keys, or null.
HasIndexedProperty(TValue, uint)Whether the object has an indexed property at index (without getting its value); false when it has not, and the adapter then calls IJsHostObjectHandler<TValue>.TryGetOwnProperty with the key.
TryDefineOwnProperty(TValue, TValue, JsPropertyDescriptor<TValue>, bool)[[DefineOwnProperty]]. Sets result to the result of the operation.
TryDelete(TValue, TValue, bool)[[Delete]]. Sets result to the result of the operation.
TryGetIndexedProperty(TValue, uint, JsPropertyDescriptor<TValue>)[[GetOwnProperty]] of a key that is an array index, when the object has an indexed property at index; otherwise false, and the adapter calls IJsHostObjectHandler<TValue>.TryGetOwnProperty with the key (it avoids converting the index to a string).
TryGetOwnProperty(TValue, TValue, JsPropertyDescriptor<TValue>)[[GetOwnProperty]].
TrySet(TValue, TValue, TValue, bool)[[Set]] when the receiver is the object. Sets result to the result of the operation.
TrySet(TValue, TValue, TValue, TValue, bool)[[Set]] when the receiver is another object (an object whose prototype chain contains the object). Sets result to the result of the operation.

GetOwnKeys(TValue)

[[OwnPropertyKeys]]: the keys that precede the ordinary keys, or null.

IReadOnlyList<TValue>? GetOwnKeys(TValue obj)

Parameters

obj TValue

Returns

IReadOnlyList<TValue>?

HasIndexedProperty(TValue, uint)

IJsAdapter.cs

Whether the object has an indexed property at index (without getting its value); false when it has not, and the adapter then calls IJsHostObjectHandler<TValue>.TryGetOwnProperty with the key.

public bool HasIndexedProperty(TValue obj, uint index)

Parameters

obj TValue
index uint

Returns

bool

TryDefineOwnProperty(TValue, TValue, JsPropertyDescriptor<TValue>, bool)

[[DefineOwnProperty]]. Sets result to the result of the operation.

bool TryDefineOwnProperty(TValue obj, TValue key, in JsPropertyDescriptor<TValue> descriptor, out bool result)

Parameters

obj TValue
key TValue
descriptor JsPropertyDescriptor<TValue>
result bool

Returns

bool

TryDelete(TValue, TValue, bool)

[[Delete]]. Sets result to the result of the operation.

bool TryDelete(TValue obj, TValue key, out bool result)

Parameters

obj TValue
key TValue
result bool

Returns

bool

TryGetIndexedProperty(TValue, uint, JsPropertyDescriptor<TValue>)

IJsAdapter.cs

[[GetOwnProperty]] of a key that is an array index, when the object has an indexed property at index; otherwise false, and the adapter calls IJsHostObjectHandler<TValue>.TryGetOwnProperty with the key (it avoids converting the index to a string).

public bool TryGetIndexedProperty(TValue obj, uint index, out JsPropertyDescriptor<TValue> descriptor)

Parameters

obj TValue
index uint
descriptor JsPropertyDescriptor<TValue>

Returns

bool

TryGetOwnProperty(TValue, TValue, JsPropertyDescriptor<TValue>)

[[GetOwnProperty]].

bool TryGetOwnProperty(TValue obj, TValue key, out JsPropertyDescriptor<TValue> descriptor)

Parameters

obj TValue
key TValue
descriptor JsPropertyDescriptor<TValue>

Returns

bool

TrySet overloads

TrySet(TValue, TValue, TValue, bool)

[[Set]] when the receiver is the object. Sets result to the result of the operation.

bool TrySet(TValue obj, TValue key, TValue value, out bool result)
Parameters
obj TValue
key TValue
value TValue
result bool
Returns

bool

TrySet(TValue, TValue, TValue, TValue, bool)

[[Set]] when the receiver is another object (an object whose prototype chain contains the object). Sets result to the result of the operation.

bool TrySet(TValue obj, TValue key, TValue value, TValue receiver, out bool result)
Parameters
obj TValue
key TValue
value TValue
receiver TValue
result bool
Returns

bool