PolyglotContext
The Polyglot Context is the core of the Elide runtime: it evaluates guest code in the embedded VM, returning the execution result. Context instances can be acquired from a PolyglotEngine.
Contexts are fully generic, meaning they do not impose constraints on the nature of the guest code (as long as the requested language is supported by the context), nor do they infer any execution details from it. This allows specific use cases such as SSR to be built using the context API without coupling.
Configuration
Contexts can be configured using plugins that subscribe to the ContextCreated event and update the provided PolyglotContextBuilder.
Plugins are installed into the engine when it is initialized, and will receive an event for every context issued by acquire.
Guest code execution
To evaluate and execute a unit of guest code, call evaluate indicating the target GuestLanguage and source, the returned PolyglotValue will contain the result of the execution, depending on the context configuration.
Types
Specifies options related to the evaluate step for a given chunk of guest code; these options can be provided optionally at the call-site to control the behavior of the evaluation.
Default implementation of EvaluationOptions.
Functions
Evaluate the given source, returning the result of the execution. Depending on the configuration of the context, this method may fail if the selected language is not enabled in the underlying engine.