JSManagedValue
A JavaScript value with conditional retain behavior to provide automatic memory management.
Declaration
class JSManagedValueOverview
The primary use case for a managed value is to store a JavaScript value in an Objective-C or Swift object that exports to JavaScript.
A managed value’s conditional retain behavior ensures retention of its underlying JavaScript value as long as either of the following conditions is true:
The JavaScript value is reachable through the JavaScript object graph (that is, not subject to JavaScript garbage collection).
The JSManagedValue object is reachable through the Objective-C or Swift object graph, as you report to the JavaScriptCore virtual machine using the addManagedReference(_:withOwner:) method.
However, if neither of these conditions is true, the managed value sets its value property to nil, releasing the underlying JSValue object.