Skip to content

@tripo3d/lens / index / PluginContext

Interface: PluginContext ​

Defined in: src/core/plugin.ts:9

L2 Core 暴露给 Plugin 的最小内核上下文:只给必需的共享基建,不透传整包参数/平台对象/Core 实例

Properties ​

PropertyModifierTypeDescriptionDefined in
appreadonlystring已归一的 App 段(来自 init 的 app,缺省/非法回落 'tripo');各插件据此拼 event_format 的 App 段src/core/plugin.ts:11
buspublicPick<EventBus, "on" | "off">L2 EventBus:订阅核心/跨插件事件(如 user.identified)。只暴露 on/off,不暴露 emitsrc/core/plugin.ts:14
configreadonlyRemoteTraceConfig已解析的远端配置快照:init 统一 await 一次(有界超时、三层降级、永非 null),setup 内同步读src/core/plugin.ts:17
deviceIdreadonlystring已解析的 device id;init 后可用,SSR 下为空字符串src/core/plugin.ts:20
emitpublic(event) => Promise<void>emit 一个 RawEvent,经 Pipeline 加工后入队;Plugin 不直接发请求。 resolve 时机随优先级:P0 送达成功才 resolve、失败 reject(保「成功后才去重/回调」语义); P1/P2 入队即 resolve;被 Pipeline 丢弃同样 resolve 且不发送。src/core/plugin.ts:27
entryUrlreadonlyURLSnapshot | null构造 Core 时快照的 entry URL;SSR 下为 nullsrc/core/plugin.ts:30
getIdentitypublic() => IdentitySnapshot读取身份快照(device 之外的 user_id / traits)src/core/plugin.ts:33
ingestUrlreadonlystringSDK 自身上报接口的完整 URL;ErrorPlugin api 采集器据此自排除,避免上报失败反馈环src/core/plugin.ts:35
provideCapabilitypublic<T>(name, value) => Disposable注册具名能力(L2 Capability),返回注销句柄供 teardown 摘除;同名重复注册抛错src/core/plugin.ts:38
reportErrorpublic(err, ctx) => void统一错误上报,转发到 init 的 onErrorsrc/core/plugin.ts:40

基于 MIT 协议发布(内部使用)