Skip to content

API > @blocksuite/blocks > ThemeObserver

Class: ThemeObserver ​

Observer theme changing by data-theme property

Extends ​

Constructors ​

constructor ​

new ThemeObserver(): ThemeObserver

Returns ​

ThemeObserver

Inherited from ​

Slot<CssVariablesMap>.constructor

Properties ​

_cssVariables ​

private _cssVariables: null | CssVariablesMap = null

Defined In ​

packages/blocks/src/_common/theme/theme-observer.ts:29


_mode ​

private _mode: string = ''

Defined In ​

packages/blocks/src/_common/theme/theme-observer.ts:28


_observer ​

private optional _observer: MutationObserver

Defined In ​

packages/blocks/src/_common/theme/theme-observer.ts:26


subscribe ​

subscribe: function

Type parameters ​

Parameter
U

Parameters ​

ParameterType
selectorfunction
callbackfunction
config?object
config.equalityFn?function
config.filter?function

Returns ​

Disposable

Defined In ​

packages/global/dist/utils/slot.d.ts:8

Inherited from ​

Slot.subscribe

Accessors ​

cssVariables ​

get cssVariables(): null | CssVariablesMap

Defined In ​

packages/blocks/src/_common/theme/theme-observer.ts:31

Methods ​

dispose ​

dispose(): void

Returns ​

void

Overrides ​

Slot.dispose

Defined In ​

packages/blocks/src/_common/theme/theme-observer.ts:51


emit ​

emit(v): void

Parameters ​

ParameterType
vCssVariablesMap

Returns ​

void

Inherited from ​

Slot.emit

Defined In ​

packages/global/dist/utils/slot.d.ts:14


filter ​

filter(testFun): Slot< CssVariablesMap >

Parameters ​

ParameterType
testFunfunction

Returns ​

Slot< CssVariablesMap >

Inherited from ​

Slot.filter

Defined In ​

packages/global/dist/utils/slot.d.ts:6


observe ​

observe(element): void

Parameters ​

ParameterType
elementElement

Returns ​

void

Defined In ​

packages/blocks/src/_common/theme/theme-observer.ts:35


on ​

on(callback): Disposable

Parameters ​

ParameterType
callbackfunction

Returns ​

Disposable

Inherited from ​

Slot.on

Defined In ​

packages/global/dist/utils/slot.d.ts:7


once ​

once(callback): Disposable

Parameters ​

ParameterType
callbackfunction

Returns ​

Disposable

Inherited from ​

Slot.once

Defined In ​

packages/global/dist/utils/slot.d.ts:12


pipe ​

pipe(that): Slot< CssVariablesMap >

Parameters ​

ParameterType
thatSlot< CssVariablesMap >

Returns ​

Slot< CssVariablesMap >

Inherited from ​

Slot.pipe

Defined In ​

packages/global/dist/utils/slot.d.ts:15


toDispose ​

toDispose(disposables): Slot< CssVariablesMap >

Parameters ​

ParameterType
disposablesDisposable[]

Returns ​

Slot< CssVariablesMap >

Inherited from ​

Slot.toDispose

Defined In ​

packages/global/dist/utils/slot.d.ts:17


unshift ​

unshift(callback): Disposable

Parameters ​

ParameterType
callbackfunction

Returns ​

Disposable

Inherited from ​

Slot.unshift

Defined In ​

packages/global/dist/utils/slot.d.ts:13