Core API
包和导入
查找可选包和 Core 子路径入口。
初始配置请使用安装。本页列出其他能力及其导入方式。
包
| 包 | 用途 | 指南 |
|---|---|---|
@nexus-js/core | 连接、服务、回调和资源 | 快速开始 |
@nexus-js/chrome | Chrome 扩展通信 | Chrome |
@nexus-js/iframe | 父页面/iframe 通信 | iframe |
@nexus-js/node-ipc | 本地守护进程与客户端通信 | Node IPC |
@nexus-js/react | React 集成 | React |
@nexus-js/testing | 应用级测试替身 | 测试 |
将测试工具安装为开发依赖。它们模拟公共应用接口,不模拟传输层或真实会话。
Core 子路径导入
这些入口包含在 @nexus-js/core 中,无需安装独立的包。
| 导入路径 | 用途 |
|---|---|
@nexus-js/core/state | 同步状态 |
@nexus-js/core/transport | 适配器作者使用的传输契约 |
@nexus-js/core/transport/virtual-port | 在消息总线上复用端口 |
例如:
import { connectNexusStore } from "@nexus-js/core/state";使用现有适配器的应用通常无需导入底层传输入口。