mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 01:56:27 +08:00
docs(editor): improve documentation for store class (#10949)
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
[**@blocksuite/store**](../../../@blocksuite/store/README.md)
|
||||
|
||||
***
|
||||
|
||||
[BlockSuite API Documentation](../../../README.md) / [@blocksuite/store](../README.md) / StoreSlots
|
||||
|
||||
# Interface: StoreSlots
|
||||
|
||||
Slots for receiving events from the store.
|
||||
All events are rxjs Subjects, you can subscribe to them like this:
|
||||
|
||||
```ts
|
||||
store.slots.ready.subscribe(() => {
|
||||
console.log('store is ready');
|
||||
});
|
||||
```
|
||||
|
||||
You can also use rxjs operators to handle the events.
|
||||
|
||||
## Properties
|
||||
|
||||
### blockUpdated
|
||||
|
||||
> **blockUpdated**: `Subject`\<`StoreBlockUpdatedPayloads`\>
|
||||
|
||||
***
|
||||
|
||||
### historyUpdated
|
||||
|
||||
> **historyUpdated**: `Subject`\<`void`\>
|
||||
|
||||
This fires when the doc history is updated.
|
||||
|
||||
***
|
||||
|
||||
### ready
|
||||
|
||||
> **ready**: `Subject`\<`void`\>
|
||||
|
||||
This fires after `doc.load` is called.
|
||||
The Y.Doc is fully loaded and ready to use.
|
||||
|
||||
***
|
||||
|
||||
### rootAdded
|
||||
|
||||
> **rootAdded**: `Subject`\<`string`\>
|
||||
|
||||
This fires when the root block is added via API call or has just been initialized from existing ydoc.
|
||||
useful for internal block UI components to start subscribing following up events.
|
||||
Note that at this moment, the whole block tree may not be fully initialized yet.
|
||||
|
||||
***
|
||||
|
||||
### rootDeleted
|
||||
|
||||
> **rootDeleted**: `Subject`\<`string`\>
|
||||
|
||||
This fires when the root block is deleted via API call or has just been removed from existing ydoc.
|
||||
In most cases, you don't need to subscribe to this event.
|
||||
Reference in New Issue
Block a user