/// <summary> /// Sets a user implemented callback to fetch additional imported modules in ES modules /// </summary> /// <param name="fetchImportedModuleCallback">The callback function being set</param> public void SetFetchImportedModuleCallback(JsFetchImportedModuleCallback fetchImportedModuleCallback) { JsErrorHelpers.ThrowIfError(NativeMethods.JsSetModuleHostInfo(this, JsModuleHostInfoKind.FetchImportedModuleCallback, Marshal.GetFunctionPointerForDelegate(fetchImportedModuleCallback) )); }
/// <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; }