/// <summary>
        /// Adds a instance of <see cref="NiLJsEngineFactory"/> to
        /// the specified <see cref="JsEngineFactoryCollection" />
        /// </summary>
        /// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param>
        /// <param name="configure">The delegate to configure the provided <see cref="NiLSettings"/></param>
        /// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns>
        public static JsEngineFactoryCollection AddNiL(this JsEngineFactoryCollection source,
                                                       Action <NiLSettings> configure)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            var settings = new NiLSettings();

            configure(settings);

            return(source.AddNiL(settings));
        }
        /// <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);
            }
        }
        /// <summary>
        /// Adds a instance of <see cref="NiLJsEngineFactory"/> to
        /// the specified <see cref="JsEngineFactoryCollection" />
        /// </summary>
        /// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param>
        /// <param name="settings">Settings of the NiL JS engine</param>
        /// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns>
        public static JsEngineFactoryCollection AddNiL(this JsEngineFactoryCollection source, NiLSettings settings)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            source.Add(new NiLJsEngineFactory(settings));

            return(source);
        }
 /// <summary>
 /// Constructs an instance of the NiL JS engine factory
 /// </summary>
 /// <param name="settings">Settings of the NiL JS engine</param>
 public NiLJsEngineFactory(NiLSettings settings)
 {
     _settings = settings;
 }