MsieJavaScriptEngine.JsRt.JavaScriptRuntime.SetBeforeCollectCallback C# (CSharp) Method

SetBeforeCollectCallback() public method

Sets a callback function that is called by the runtime before garbage collection.

The callback is invoked on the current runtime execution thread, therefore execution is blocked until the callback completes.

The callback can be used by hosts to prepare for garbage collection. For example, by releasing unnecessary references on Chakra objects.

public SetBeforeCollectCallback ( IntPtr callbackState, JavaScriptBeforeCollectCallback beforeCollectCallback ) : void
callbackState System.IntPtr /// User provided state that will be passed back to the callback. ///
beforeCollectCallback JavaScriptBeforeCollectCallback The callback function being set.
return void
        public void SetBeforeCollectCallback(IntPtr callbackState, JavaScriptBeforeCollectCallback beforeCollectCallback)
        {
            Native.ThrowIfError(Native.JsSetRuntimeBeforeCollectCallback(this, callbackState, beforeCollectCallback));
        }