using System; using JavaScriptEngineSwitcher.Core; namespace JavaScriptEngineSwitcher.Yantra { /// /// JS engine factory collection extensions /// public static class JsEngineFactoryCollectionExtensions { /// /// Adds a instance of to /// the specified /// /// Instance of /// Instance of public static JsEngineFactoryCollection AddYantra(this JsEngineFactoryCollection source) { if (source is null) { throw new ArgumentNullException(nameof(source)); } return source.AddYantra(new YantraSettings()); } /// /// Adds a instance of to /// the specified /// /// Instance of /// The delegate to configure the provided /// Instance of public static JsEngineFactoryCollection AddYantra(this JsEngineFactoryCollection source, Action configure) { if (source is null) { throw new ArgumentNullException(nameof(source)); } if (configure is null) { throw new ArgumentNullException(nameof(configure)); } var settings = new YantraSettings(); configure(settings); return source.AddYantra(settings); } /// /// Adds a instance of to /// the specified /// /// Instance of /// Settings of the Yantra JS engine /// Instance of public static JsEngineFactoryCollection AddYantra(this JsEngineFactoryCollection source, YantraSettings settings) { if (source is null) { throw new ArgumentNullException(nameof(source)); } if (settings is null) { throw new ArgumentNullException(nameof(settings)); } source.Add(new YantraJsEngineFactory(settings)); return source; } } }