jSValueProtect top-level property

void Function(Pointer<NativeType> ctx, Pointer<NativeType> value) jSValueProtect

Protects a JavaScript value from garbage collection. Use this method when you want to store a JSValue in a global or on the heap, where the garbage collector will not be able to discover your reference to it.

A value may be protected multiple times and must be unprotected an equal number of times before becoming eligible for garbage collection. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to protect.


final void Function(Pointer ctx, Pointer value) jSValueProtect = jscLib
    .lookup<NativeFunction<Void Function(Pointer, Pointer)>>('JSValueProtect')