IExecutionContext.

GetJavaScriptEnginePool(Action<IJavaScriptEngine>, int, int, int, Nullable<TimeSpan>) Method

Summary

Gets a new Wyam.Common.JavaScript.IJavaScriptEnginePool. The returned engine pool should be disposed when no longer needed.
Assembly
Wyam.Common.dll
Namespace
Wyam.Common.Execution
Containing Type
IExecutionContext

Syntax

IJavaScriptEnginePool GetJavaScriptEnginePool(Action<IJavaScriptEngine> initializer = null, int startEngines = 10, int maxEngines = 25, int maxUsagesPerEngine = 100, Nullable<TimeSpan> engineTimeout = null)

Parameters

Name Type Description
initializer Action<IJavaScriptEngine> The code to run when a new engine is created. This should configure the environment and set up any required JavaScript libraries.
startEngines int The number of engines to initially start when a pool is created.
maxEngines int The maximum number of engines that will be created in the pool.
maxUsagesPerEngine int The maximum number of times an engine can be reused before it is disposed.
engineTimeout Nullable<TimeSpan> The default timeout to use when acquiring an engine from the pool (defaults to 5 seconds). If an engine can not be acquired in this timeframe, an exception will be thrown.

Return Value

Type Description
IJavaScriptEnginePool A new JavaScript engine pool.
GitHub