@node-red/runtime

此模块提供 Node-RED 的核心运行时组件。它包括 Node-RED 编辑器。与此模块的所有交互都通过所提供的 API 完成。

成员

comms : { ... }
context : { ... }
flows : { ... }
library : { ... }
nodes : { ... }
plugins : { ... }
projects : { ... }
settings : { ... }

init(settings, server, adminApi)

初始化运行时模块。

参数
名称 类型 描述
设置 对象

运行时设置对象

服务器 HTTPServer

服务器使用的 HTTP 服务器实例

adminApi AdminAPI

@node-red/editor-api 的一个实例。TODO:这需要更好地抽象。

isStarted(opts) → {Promise.<Boolean>}

返回运行时是否已启动

参数
名称 类型 描述
opts 对象
名称 类型 描述
user User

调用API的用户

返回
类型
Promise.<Boolean>
  • 运行时是否已启动

start() → {Promise}

启动运行时。

返回
类型
Promise
  • 当运行时启动时解析。这不意味着流将运行,因为它们是异步启动的。

stop() → {Promise}

停止运行时。

一旦调用,Node-RED 不应在 Node.JS 进程重新启动之前重新启动。

返回
类型
Promise
  • 当运行时停止时解析。

version(opts) → {Promise.<String>}

返回运行时的版本号

参数
名称 类型 描述
opts 对象
名称 类型 描述
user User

调用API的用户

返回
类型
Promise.<String>
  • 运行时版本号