/// <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)
                                                                   ));
 }
예제 #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;
 }
예제 #4
0
 internal static extern JsErrorCode JsSetModuleHostInfo(JsModuleRecord requestModule,
                                                        JsModuleHostInfoKind moduleHostInfo,
                                                        JsNotifyModuleReadyCallback callback);
예제 #5
0
 public void SetHostInfo(JsNotifyModuleReadyCallback ready) =>
 Native.ThrowIfError(Native.JsSetModuleHostInfo(this, ready));