JsCreateContext Function

Creates a script context for running scripts.

Syntax

// Edge mode signature
STDAPI_(JsErrorCode) JsCreateContext(
   _In_ JsRuntimeHandle runtime,
   _Out_ JsContextRef *newContext);

// Legacy mode signature
STDAPI_(JsErrorCode) JsCreateContext(
   _In_ JsRuntimeHandle runtime,
   _In_ IDebugApplication *debugApplication,
   _Out_ JsContextRef *newContext
);

Parameters

  • runtime
    The runtime the script context is being created in.

  • debugApplication
    The debug application to use for debugging. This parameter can be null, in which case debugging is not enabled for the context.

  • newContext
    The created script context.

Return Value

The code JsNoError if the operation succeeded, a failure code otherwise.

Remarks

Each script context has its own global object that is isolated from all other script contexts.

The debugApplication parameter is not supported in Edge mode. For more information on using this API in Edge mode, see Targeting Edge vs. Legacy Engines in JsRT APIs.

Requirements

Header: jsrt.h

See Also

Reference (JavaScript Runtime)