/// <summary> /// Creates a new JavaScript engine pool /// </summary> /// <param name="config"> /// The configuration to use. If not provided, a default configuration will be used. /// </param> public JsPool(JsPoolConfig config = null) { _config = config ?? new JsPoolConfig(); _engineFactory = CreateEngineFactory(); PopulateEngines(); InitializeWatcher(); }
/// <summary> /// Creates a new JavaScript engine pool. /// </summary> protected virtual IJsPool CreatePool() { var allFiles = _config.Scripts .Concat(_config.ScriptsWithoutTransform) .Select(_fileSystem.MapPath); var poolConfig = new JsPoolConfig { EngineFactory = _factory, Initializer = InitialiseEngine, WatchPath = _fileSystem.MapPath("~/"), WatchFiles = allFiles }; if (_config.MaxEngines != null) { poolConfig.MaxEngines = _config.MaxEngines.Value; } if (_config.StartEngines != null) { poolConfig.StartEngines = _config.StartEngines.Value; } var pool = new JsPool(poolConfig); // Reset the recycle exception on recycle. If there *are* errors loading the scripts // during recycle, the errors will be caught in the initializer. pool.Recycled += (sender, args) => _scriptLoadException = null; return pool; }
/// <summary> /// Creates a new JavaScript engine pool /// </summary> /// <param name="config"> /// The configuration to use. If not provided, a default configuration will be used. /// </param> public JsPool(JsPoolConfig <TOriginal> config) { _config = config; _engineFactory = CreateEngineFactory(); PopulateEngines(); InitializeWatcher(); }
/// <summary> /// Creates a new JavaScript engine pool. /// </summary> protected virtual IJsPool CreatePool() { var allFiles = _config.Scripts .Concat(_config.ScriptsWithoutTransform) .Select(_fileSystem.MapPath); var poolConfig = new JsPoolConfig { EngineFactory = _factory, Initializer = InitialiseEngine, WatchPath = _fileSystem.MapPath("~/"), WatchFiles = allFiles }; if (_config.MaxEngines != null) { poolConfig.MaxEngines = _config.MaxEngines.Value; } if (_config.StartEngines != null) { poolConfig.StartEngines = _config.StartEngines.Value; } return new JsPool(poolConfig); }
/// <summary> /// Creates a new JavaScript engine pool /// </summary> /// <param name="config"> /// The configuration to use. If not provided, a default configuration will be used. /// </param> public JsPool(JsPoolConfig config = null) : base(config ?? new JsPoolConfig()) { }