JSResolveOp is the type of the JSClass.resolve.

Syntax

typedef bool
(* JSResolveOp)(JSContext *cx, JS::HandleObject obj,
                JS::HandleId id, bool *resolvedp); // Added in JSAPI 36
typedef bool
(* JSResolveOp)(JSContext *cx, JS::HandleObject obj,
                JS::HandleId id); // Obsolete since JSAPI 36
Name Type Description
cx JSContext * Pointer to the JS context in which the property access is taking place.
obj JS::HandleObject Pointer to the object whose properties are being accessed.
id JS::HandleId The name or index of the property being resolved.
resolvedp bool * Out parameter. Receives the result of resolve operation.

Description

JSResolveOp callback is a hook which is called when a property is not found on an object.

It resolves a lazy property named by id in obj by defining it directly in obj. Lazy properties are those reflected from some peer native property space (e.g., the DOM attributes for a given node reflected as obj) on demand.

The callback must set *resolvedp to true and return true if the property is resolved, or set *resolvedp to false and return true if the object has no lazy property with the given id; or return false to indicate any other error.

Obsolete since JSAPI 36

The callback must return true if the property is resolved, or if the object has no lazy property with the given id; or false to indicate any other error.

Note: JSNewResolveOp provides a cheaper way to resolve lazy properties.

JSClass hooks

JSClass offers the following hook:

See Also