Skip to content

InternalAPI

Defined in: jsEngine/api/Internal.ts:32

The internal API provides access to some of js engines internals.

Constructors

new InternalAPI()

new InternalAPI(apiInstance): InternalAPI

Defined in: jsEngine/api/Internal.ts:35

Parameters

Parameter Type

apiInstance

API

Returns

InternalAPI

Methods

createExecutionGlobals()

createExecutionGlobals(options): JsExecutionGlobals

Defined in: jsEngine/api/Internal.ts:250

Creates execution globals.

Parameters

Parameter Type Description

options

JsExecutionGlobalsConstructionOptions

Returns

JsExecutionGlobals


createRenderer()

createRenderer(container, sourcePath, component): ResultRenderer

Defined in: jsEngine/api/Internal.ts:57

Creates a result renderer.

Parameters

Parameter Type Description

container

HTMLElement

sourcePath

string

component

Component

Returns

ResultRenderer


execute()

execute(params): Promise<JsExecution>

Defined in: jsEngine/api/Internal.ts:44

Executes the given code.

Parameters

Parameter Type Description

params

EngineExecutionParams

Returns

Promise<JsExecution>


executeFile()

executeFile(path, params): Promise<JsExecution>

Defined in: jsEngine/api/Internal.ts:72

Load and execute the given file.

Parameters

Parameter Type Description

path

string

params

ExecuteFileEngineExecutionParams

Returns

Promise<JsExecution>


executeFileSimple()

executeFileSimple(path, params?): Promise<JsExecution>

Defined in: jsEngine/api/Internal.ts:97

Lead and execute the given file. This method also handles the lifetime of the execution. The component for the execution is created and destroyed automatically.

Parameters

Parameter Type Description

path

string

params?

ExecuteFileSimpleEngineExecutionParams

Returns

Promise<JsExecution>


executeStartupScripts()

executeStartupScripts(): Promise<void>

Defined in: jsEngine/api/Internal.ts:266

Runs all startup scripts defined in the plugins settings.

Returns

Promise<void>


getContextForFile()

getContextForFile(path): Promise<ExecutionContext>

Defined in: jsEngine/api/Internal.ts:121

Gets the execution context for a specific file, throws when the file does not exist.

Parameters

Parameter Type Description

path

string

Returns

Promise<ExecutionContext>


getContextForJSFile()

getContextForJSFile(path): Promise<JSFileExecutionContext>

Defined in: jsEngine/api/Internal.ts:208

Gets the execution context for a JS file.

Parameters

Parameter Type Description

path

string

The file path of the JS file.

Returns

Promise<JSFileExecutionContext>


getContextForMarkdownCallingJSFile()

getContextForMarkdownCallingJSFile(markdownPath, jsPath): Promise<MarkdownCallingJSFileExecutionContext>

Defined in: jsEngine/api/Internal.ts:167

Gets the execution context for when a markdown file calls a JS file. This adds some extra info about the markdown file into the context, compared to getContextForJSFile.

Parameters

Parameter Type Description

markdownPath

string

The file path of the markdown file.

jsPath

string

The file path of the JS file.

Returns

Promise<MarkdownCallingJSFileExecutionContext>


getContextForMarkdownCodeBlock()

getContextForMarkdownCodeBlock(path): Promise<MarkdownCodeBlockExecutionContext>

Defined in: jsEngine/api/Internal.ts:145

Gets the execution context for a markdown code block.

Parameters

Parameter Type Description

path

string

The file path of the markdown file the code block is in.

Returns

Promise<MarkdownCodeBlockExecutionContext>


getContextForMarkdownOther()

getContextForMarkdownOther(path): Promise<MarkdownOtherExecutionContext>

Defined in: jsEngine/api/Internal.ts:189

Gets the execution context for a markdown code block.

Parameters

Parameter Type Description

path

string

The file path of the markdown file the code block is in.

Returns

Promise<MarkdownOtherExecutionContext>


getContextForUnknown()

getContextForUnknown(path?): Promise<UnknownExecutionContext>

Defined in: jsEngine/api/Internal.ts:225

Gets an unknown execution context for anything that is not a markdown code block or a JS file.

Parameters

Parameter Type Description

path?

string

An optional file path that will get resolved to a TFile.

Returns

Promise<UnknownExecutionContext>