JavaScriptPool

class JavaScriptPool(size: Int, nullGlobalContext: Boolean = false) : AbstractScriptPool<JavaScript>

A pre-populated pool of JavaScript instances backed by a coroutine Channel.

Instances are created eagerly during initialization and recycled with context resets after each use.

Parameters

size

the number of JavaScript instances to create in the pool

nullGlobalContext

ignored: JavaScript binds variables into the engine scope, never the global scope, so its global context is always non-null. Retained for API symmetry with the other script pools.

Constructors

Link copied to clipboard
constructor(size: Int, nullGlobalContext: Boolean = false)

Properties

Link copied to clipboard
Link copied to clipboard
val size: Int

Functions

Link copied to clipboard
suspend fun <R> eval(block: JavaScript.() -> R): R