/// <summary> /// Sets a user implemented callback to get notification when the module is ready /// </summary> /// <param name="notifyModuleReadyCallback">The callback function being set</param> public void SetNotifyModuleReadyCallback(JsNotifyModuleReadyCallback notifyModuleReadyCallback) { JsErrorHelpers.ThrowIfError(NativeMethods.JsSetModuleHostInfo(this, JsModuleHostInfoKind.NotifyModuleReadyCallback, Marshal.GetFunctionPointerForDelegate(notifyModuleReadyCallback) )); }
/// <summary> /// Disposes a ES module manager /// </summary> public void Dispose() { if (_disposedFlag.Set()) { if (_moduleJobQueue != null) { _moduleJobQueue.Clear(); _moduleJobQueue = null; } if (_moduleCache != null) { _moduleCache.Clear(); _moduleCache = null; } _fetchImportedModuleCallback = null; _notifyModuleReadyCallback = null; _getNextSourceContext = null; } }
/// <summary> /// Constructs an instance of ES module manager /// </summary> /// <param name="getNextSourceContext">Delegate that returns a new source context</param> public EsModuleManager(Func <JsSourceContext> getNextSourceContext) { _getNextSourceContext = getNextSourceContext; _fetchImportedModuleCallback = FetchImportedModule; _notifyModuleReadyCallback = NotifyModuleReady; }
internal static extern JsErrorCode JsSetModuleHostInfo(JsModuleRecord requestModule, JsModuleHostInfoKind moduleHostInfo, JsNotifyModuleReadyCallback callback);
public void SetHostInfo(JsNotifyModuleReadyCallback ready) => Native.ThrowIfError(Native.JsSetModuleHostInfo(this, ready));