Skip to content

pantoken-root / formats/scope/src / PantokenScope

接口: PantokenScope ​

Beta

绑定到单个元素的实时作用域。

属性 ​

element ​

readonly element: HTMLElement

Beta

承载作用域属性的元素。


instanceId ​

readonly instanceId: string

Beta

徽标所属的产品。

方法 ​

get() ​

get(): ScopeConfig

Beta

作用域自身的配置 — 它声明的内容,而非继承得来的内容。

返回值 ​

ScopeConfig


set() ​

set(patch): void

Beta

合并部分配置。对字段传入 null 可清除该字段并重新继承。

参数 ​

patch ​

Partial<Record<keyof ScopeConfig, string | null | undefined>>

返回值 ​

void


resolve() ​

resolve(el?): ResolvedScope

Beta

解析后代的生效作用域(默认为此作用域自身的元素))。

参数 ​

el? ​

Element

返回值 ​

ResolvedScope


attachFrame() ​

attachFrame(frame): () => void

Beta

将此作用域的状态发送到 frame 并保持同步。返回一个分离函数。

参数 ​

frame ​

HTMLIFrameElement

返回值 ​

() => void


subscribe() ​

subscribe(listener): () => void

Beta

观察更改。返回一个取消订阅的函数。

参数 ​

listener ​

(config) => void

返回值 ​

() => void


destroy() ​

destroy(): void

Beta

移除属性、分离框架并注销。

返回值 ​

void