Skip to content

BlockSuite API Documentation / @blocksuite/blocks / MobileSpecsPatches

Class: MobileSpecsPatches

A life cycle watcher is an extension that watches the life cycle of the editor. It is used to perform actions when the editor is created, mounted, rendered, or unmounted.

When creating a life cycle watcher, you must define a key that is unique to the watcher. The key is used to identify the watcher in the dependency injection container.

ts
class MyLifeCycleWatcher extends LifeCycleWatcher {
 static override readonly key = 'my-life-cycle-watcher';

In the life cycle watcher, the methods will be called in the following order:

  1. created: Called when the std is created.
  2. rendered: Called when std.render is called.
  3. mounted: Called when the editor host is mounted.
  4. unmounted: Called when the editor host is unmounted.

Extends

Constructors

new MobileSpecsPatches()

new MobileSpecsPatches(std): MobileSpecsPatches

Parameters

std

BlockStdScope

Returns

MobileSpecsPatches

Overrides

LifeCycleWatcher.constructor

Defined in

packages/blocks/src/_specs/preset/mobile-patch.ts:24

Properties

std

readonly std: BlockStdScope

Inherited from

LifeCycleWatcher.std

Defined in

packages/framework/block-std/dist/extension/lifecycle-watcher.d.ts:22


key

static key: string = 'mobile-patches'

Overrides

LifeCycleWatcher.key

Defined in

packages/blocks/src/_specs/preset/mobile-patch.ts:22

Methods

created()

created(): void

Called when std is created.

Returns

void

Inherited from

LifeCycleWatcher.created

Defined in

packages/framework/block-std/dist/extension/lifecycle-watcher.d.ts:29


mounted()

mounted(): void

Called when editor host is mounted. Which means the editor host emit the connectedCallback lifecycle event.

Returns

void

Overrides

LifeCycleWatcher.mounted

Defined in

packages/blocks/src/_specs/preset/mobile-patch.ts:100


rendered()

rendered(): void

Called when std.render is called.

Returns

void

Inherited from

LifeCycleWatcher.rendered

Defined in

packages/framework/block-std/dist/extension/lifecycle-watcher.d.ts:38


unmounted()

unmounted(): void

Called when editor host is unmounted. Which means the editor host emit the disconnectedCallback lifecycle event.

Returns

void

Inherited from

LifeCycleWatcher.unmounted

Defined in

packages/framework/block-std/dist/extension/lifecycle-watcher.d.ts:43


setup()

static setup(di): void

Parameters

di

Container

Returns

void

Overrides

LifeCycleWatcher.setup

Defined in

packages/blocks/src/_specs/preset/mobile-patch.ts:31