/// <summary>
        /// Adds a instance of <see cref="NodeJsEngineFactory"/> to
        /// the specified <see cref="JsEngineFactoryCollection" />
        /// </summary>
        /// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param>
        /// <param name="services">The services available in the application</param>
        /// <param name="configure">The delegate to configure the provided <see cref="NodeSettings"/></param>
        /// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns>
        public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection source,
                                                        IServiceCollection services, Action <NodeSettings> configure)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

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

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

            var settings = new NodeSettings();

            configure(settings);

            source.Add(new NodeJsEngineFactory(services, settings));

            return(source);
        }
        /// <summary>
        /// Adds a instance of <see cref="NodeJsEngineFactory"/> to
        /// the specified <see cref="JsEngineFactoryCollection" />
        /// </summary>
        /// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param>
        /// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns>
        public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            source.Add(new NodeJsEngineFactory());

            return(source);
        }
        /// <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);
        }
Esempio n. 4
0
        /// <summary>
        /// Adds a instance of <see cref="EFFCChakraCoreJsEngineFactory"/> to
        /// the specified <see cref="JsEngineFactoryCollection" />
        /// </summary>
        /// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param>
        /// <param name="settings">Settings of the ChakraCore JS engine</param>
        /// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns>
        public static JsEngineFactoryCollection AddEFFCChakraCore(this JsEngineFactoryCollection source, EFFCChakraCoreSettings settings)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

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

            source.Add(new EFFCChakraCoreJsEngineFactory(settings));

            return(source);
        }
        /// <summary>
        /// Adds a instance of <see cref="JintJsEngineFactory"/> to
        /// the specified <see cref="JsEngineFactoryCollection" />
        /// </summary>
        /// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param>
        /// <param name="settings">Settings of the Jint JS engine</param>
        /// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns>
        public static JsEngineFactoryCollection AddJint(this JsEngineFactoryCollection source, JintSettings settings)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

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

            source.Add(new JintJsEngineFactory(settings));

            return(source);
        }
        /// <summary>
        /// Adds a instance of <see cref="NodeJsEngineFactory"/> to
        /// the specified <see cref="JsEngineFactoryCollection" />
        /// </summary>
        /// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param>
        /// <param name="services">The services available in the application</param>
        /// <param name="settings">Settings of the Node JS engine</param>
        /// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns>
        public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection source,
                                                        IServiceCollection services, NodeSettings settings)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

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

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

            source.Add(new NodeJsEngineFactory(services, settings));

            return(source);
        }