pub type JSObjectFinalizeCallback = Option<unsafe extern "C" fn(object: JSObjectRef)>;
Expand description

The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread.

  • object: The JSObject being finalized.

If you named your function Finalize, you would declare it like this:

void
Finalize(JSObjectRef object);

The finalize callback is called on the most derived class first, and the least derived class (the parent class) last.

You must not call any function that may cause a garbage collection or an allocation of a garbage collected object from within a JSObjectFinalizeCallback. This includes all functions that have a JSContextRef parameter.