跳至主要內容

接口: SelfScriptEngine

约 849 字大约 3 分钟道无涯

engines.SelfScriptEngine

当前代码的自身引擎的对象。

继承关系

目录

属性

方法

属性

execArgv

Readonly execArgv: any

执行参数。包括其他脚本启动本引擎时指定的参数,或者定时任务触发时的参数。比如由定时任务触发,则参数为{intent: ...}


executionConfig

Readonly executionConfig: ReadOnlyExecutionConfig

获取本次运行指定的运行配置。

Inherited from

ScriptEngineopen in new window.executionConfigopen in new window


id

Readonly id: number

引擎的唯一id,不同引擎的id必不相同。

Inherited from

ScriptEngineopen in new window.idopen in new window


source

Readonly source: any

引擎源文件的对象。

Inherited from

ScriptEngineopen in new window.sourceopen in new window


sourceFile

Readonly sourceFile: string

引擎的源文件路径。

Inherited from

ScriptEngineopen in new window.sourceFileopen in new window


workingDirectory

Readonly workingDirectory: string

引擎运行的所在目录。一般是项目的根目录或者脚本文件的父目录。

Inherited from

ScriptEngineopen in new window.workingDirectoryopen in new window

方法

addListener

addListener(event, listener): SelfScriptEngine

参数

名称类型
eventstring
listener(...args: any[]) => void

返回值

SelfScriptEngine

Inherited from

EngineEventTargetopen in new window.addListeneropen in new window


emit

emit(event, ...args): void

发送事件给引擎。对于nodejs引擎,可以用require("engines").myEngine().on("event_name", () => {})来监听事件;对于pro8引擎,则可以用$events.on("event_name", () => {})来监听事件。

参数

名称类型描述
eventstring事件名称
...argsany[]事件参数,必须是可以转换为JSON的数据

返回值

void

Inherited from

ScriptEngineopen in new window.emitopen in new window


eventNames

eventNames(): string[]

返回值

string[]

Inherited from

EngineEventTargetopen in new window.eventNamesopen in new window


forceStop

forceStop(): void

强制停止引擎运行。

返回值

void

Inherited from

ScriptEngineopen in new window.forceStopopen in new window


getMaxListeners

getMaxListeners(): number

返回值

number

Inherited from

EngineEventTargetopen in new window.getMaxListenersopen in new window


getTag

getTag(key): any

Returns the tag associated with this engine and the specified key.

参数

名称类型
keystring

返回值

any

Inherited from

ScriptEngineopen in new window.getTagopen in new window


listenerCount

listenerCount(event): number

参数

名称类型
eventstring

返回值

number

Inherited from

EngineEventTargetopen in new window.listenerCountopen in new window


listeners

listeners(event): Function[]

参数

名称类型
eventstring

返回值

Function[]

Inherited from

EngineEventTargetopen in new window.listenersopen in new window


off

off(event, listener): SelfScriptEngine

参数

名称类型
eventstring
listener(...args: any[]) => void

返回值

SelfScriptEngine

Inherited from

EngineEventTargetopen in new window.offopen in new window


on

on(event, listener): SelfScriptEngine

参数

名称类型
eventstring
listener(...args: any[]) => void

返回值

SelfScriptEngine

Inherited from

EngineEventTargetopen in new window.onopen in new window


once

once(event, listener): SelfScriptEngine

参数

名称类型
eventstring
listener(...args: any[]) => void

返回值

SelfScriptEngine

Inherited from

EngineEventTargetopen in new window.onceopen in new window


prependListener

prependListener(event, listener): SelfScriptEngine

参数

名称类型
eventstring
listener(...args: any[]) => void

返回值

SelfScriptEngine

Inherited from

EngineEventTargetopen in new window.prependListeneropen in new window


prependOnceListener

prependOnceListener(event, listener): SelfScriptEngine

参数

名称类型
eventstring
listener(...args: any[]) => void

返回值

SelfScriptEngine

Inherited from

EngineEventTargetopen in new window.prependOnceListeneropen in new window


rawListeners

rawListeners(event): Function[]

参数

名称类型
eventstring

返回值

Function[]

Inherited from

EngineEventTargetopen in new window.rawListenersopen in new window


removeAllListeners

removeAllListeners(event?): SelfScriptEngine

参数

名称类型
event?string

返回值

SelfScriptEngine

Inherited from

EngineEventTargetopen in new window.removeAllListenersopen in new window


removeListener

removeListener(event, listener): SelfScriptEngine

参数

名称类型
eventstring
listener(...args: any[]) => void

返回值

SelfScriptEngine

Inherited from

EngineEventTargetopen in new window.removeListeneropen in new window


setMaxListeners

setMaxListeners(n): SelfScriptEngine

参数

名称类型
nnumber

返回值

SelfScriptEngine

Inherited from

EngineEventTargetopen in new window.setMaxListenersopen in new window