Skip to content

pantoken-root / formats/scope/src / PantokenScope

Interface: PantokenScope ​

Beta

A live scope bound to one element.

Properties ​

element ​

readonly element: HTMLElement

Beta

The element carrying the scope attributes.


instanceId ​

readonly instanceId: string

Beta

The instance this scope belongs to.

Methods ​

get() ​

get(): ScopeConfig

Beta

The scope's own configuration — what it declares, not what it inherits.

Returns ​

ScopeConfig


set() ​

set(patch): void

Beta

Merge a partial configuration in. Pass null for a field to clear it and inherit again.

Parameters ​

patch ​

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

Returns ​

void


resolve() ​

resolve(el?): ResolvedScope

Beta

Resolve the effective scope for a descendant (defaults to this scope's own element).

Parameters ​

el? ​

Element

Returns ​

ResolvedScope


attachFrame() ​

attachFrame(frame): () => void

Beta

Send this scope's state to frame and keep it in sync. Returns a detach function.

Parameters ​

frame ​

HTMLIFrameElement

Returns ​

() => void


subscribe() ​

subscribe(listener): () => void

Beta

Observe changes. Returns an unsubscribe function.

Parameters ​

listener ​

(config) => void

Returns ​

() => void


destroy() ​

destroy(): void

Beta

Remove the attributes, detach frames, and unregister.

Returns ​

void