in src/React.Core/JavaScriptEngineFactory.cs [84:118]
protected virtual IJsPool CreatePool()
{
var allFiles = _config.Scripts
.Concat(_config.ScriptsWithoutTransform)
.Concat(_config.ReactAppBuildPath != null
? new[] { $"{_config.ReactAppBuildPath}/asset-manifest.json"}
: Enumerable.Empty<string>())
.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;
}
if (_config.MaxUsagesPerEngine != null)
{
poolConfig.MaxUsagesPerEngine = _config.MaxUsagesPerEngine.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;
}