Contents

JSObjectFinalizeCallback

The callback type for finalizing an object (preparing it for garbage collection).

Declaration

typealias JSObjectFinalizeCallback = (JSObjectRef?) -> Void

Parameters

Discussion

You can finalize an object on any thread.

If you name your function Finalize, you declare it like this:

void Finalize(JSObjectRef object);

The system calls the finalize callback 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.

See Also

Managing Callbacks