Contents

JSObjectSetPropertyForKey(_:_:_:_:_:_:)

Sets a property on an object using a JavaScript value as the property key.

Declaration

func JSObjectSetPropertyForKey(_ ctx: JSContextRef!, _ object: JSObjectRef!, _ propertyKey: JSValueRef!, _ value: JSValueRef!, _ attributes: JSPropertyAttributes, _ exception: UnsafeMutablePointer<JSValueRef?>!)

Parameters

  • ctx:

    The execution context to use.

  • object:

    The Jsobjectref with the property you want to set.

  • propertyKey:

    A Jsvalueref that contains the property key to use when looking up the property.

  • value:

    A Jsvalueref to use as the property’s value.

  • attributes:

    A set of Jspropertyattributes to give to the property.

  • exception:

    A pointer to a Jsvalueref to store an exception in, if any. Pass NULL to discard any exception.

Discussion

This function is the same as performing object[propertyKey] = value from JavaScript.

See Also

Working with Objects