JSManagedValue
IntroductionJSManagedValue represents a "conditionally retained" JSValue. "Conditionally retained" means that as long as either the JSManagedValue's JavaScript value is reachable through the JavaScript object graph or the JSManagedValue object is reachable through the external Objective-C object graph as reported to the JSVirtualMachine using addManagedReference:withOwner:, the corresponding JavaScript value will be retained. However, if neither of these conditions are true, the corresponding JSValue will be released and set to nil. The primary use case for JSManagedValue is for safely referencing JSValues from the Objective-C heap. It is incorrect to store a JSValue into an Objective-C heap object, as this can very easily create a reference cycle, keeping the entire JSContext alive. Methods
initWithValue:Create a JSManagedValue. - (instancetype)initWithValue:(JSValue *)value; ParametersReturn ValueThe new JSManagedValue. managedValueWithValue:Create a JSManagedValue from a JSValue. + (JSManagedValue *)managedValueWithValue:(JSValue *)value; ParametersReturn ValueThe new JSManagedValue. Properties
valueGet the JSValue from the JSManagedValue. @property (readonly, strong) JSValue *value; Return ValueThe corresponding JSValue for this JSManagedValue or nil if the JSValue has been collected. |