コード例 #1
0
 /// <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)
                                                                   ));
 }
コード例 #2
0
        /// <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;
            }
        }
コード例 #3
0
 /// <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;
 }