Files
AFFiNE-Mirror/blocksuite/docs/api/@blocksuite/std/gfx/functions/observe.md
renovate[bot] 0f7a739b3b chore: bump up all non-major dependencies (#11351)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: LongYinan <lynweklm@gmail.com>
2025-04-04 18:37:22 +08:00

1.1 KiB

BlockSuite API Documentation


BlockSuite API Documentation / @blocksuite/std / gfx / observe

Function: observe()

observe<V, E, T>(fn): (_, context) => ClassAccessorDecoratorResult<GfxPrimitiveElementModel<BaseElementProps>, V>

A decorator to observe the y type property. You can think of it is just a decorator version of 'observe' method of Y.Array and Y.Map.

The observer function start to observe the property when the model is mounted. And it will re-observe the property automatically when the value is altered.

Type Parameters

V

V

E

E extends YEvent<any>

T

T extends GfxPrimitiveElementModel<BaseElementProps>

Parameters

fn

ObserveFn<E, T>

Returns

(_, context): ClassAccessorDecoratorResult<GfxPrimitiveElementModel<BaseElementProps>, V>

Parameters

_

unknown

context

ClassAccessorDecoratorContext

Returns

ClassAccessorDecoratorResult<GfxPrimitiveElementModel<BaseElementProps>, V>