Ejemplo n.º 1
0
        public override void Dispose()
        {
            if (_disposedFlag.Set())
            {
                lock (_synchronizer)
                {
                    if (_jsContext != null)
                    {
                        if (_debuggerCallback != null)
                        {
                            _jsContext.DebuggerCallback -= _debuggerCallback;
                            _debuggerCallback            = null;
                        }

                        _jsContext = null;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructs an instance of adapter for the NiL JS engine
        /// </summary>
        /// <param name="settings">Settings of the NiL JS engine</param>
        public NiLJsEngine(NiLSettings settings)
        {
            NiLSettings niLSettings = settings ?? new NiLSettings();

            _debuggerCallback = niLSettings.DebuggerCallback;

            try
            {
                _jsContext           = new OriginalContext(niLSettings.StrictMode);
                _jsContext.Debugging = niLSettings.EnableDebugging;
                if (_debuggerCallback != null)
                {
                    _jsContext.DebuggerCallback += _debuggerCallback;
                }
            }
            catch (Exception e)
            {
                throw JsErrorHelpers.WrapEngineLoadException(e, EngineName, EngineVersion, true);
            }
        }