Instance Method

objectForKeyedSubscript:

Returns the value of the specified JavaScript property in the context’s global object, allowing subscript getter syntax.

Declaration

- (JSValue *)objectForKeyedSubscript:(id)key;

Parameters

key

The name of a JavaScript property in the context’s global JavaScript object.

Return Value

The JavaScript property named by key, or nil if no such field or function exists.

Discussion

This method first constructs a JSValue object from the key parameter, then uses that value in JavaScript to look up the name of a property in the context’s global object.

See Also

Accessing JavaScript Global State with Subscripts

- setObject:forKeyedSubscript:

Sets the specified JavaScript property of the context’s global object, allowing subscript setter syntax.