/// <summary>
/// Sets a callback function that is called by the runtime before garbage collection.
/// </summary>
/// <remarks>
/// <para>
/// The callback is invoked on the current runtime execution thread, therefore execution is
/// blocked until the callback completes.
/// </para>
/// <para>
/// The callback can be used by hosts to prepare for garbage collection. For example, by
/// releasing unnecessary references on Chakra objects.
/// </para>
/// </remarks>
/// <param name="callbackState">
/// User provided state that will be passed back to the callback.
/// </param>
/// <param name="beforeCollectCallback">The callback function being set.</param>
public void SetBeforeCollectCallback(IntPtr callbackState, JavaScriptBeforeCollectCallback beforeCollectCallback)
{
Native.ThrowIfError(Native.JsSetRuntimeBeforeCollectCallback(this, callbackState, beforeCollectCallback));
}