Skip to content

Commit 9ff5648

Browse files
committed
[RealtimeKit] slightly polish formatting for collaborative stores doc
1 parent 29090b8 commit 9ff5648

File tree

1 file changed

+11
-13
lines changed
  • src/content/docs/realtime/realtimekit/collaborative-stores

1 file changed

+11
-13
lines changed

src/content/docs/realtime/realtimekit/collaborative-stores/index.mdx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,22 @@ To create a store:
2525

2626
<RTKCodeSnippet id="web-react">
2727

28-
```ts
29-
28+
```ts
3029
const stores = useRealtimeKitSelector((m) => m.stores);
3130
const store = stores.create('myStore');
32-
3331
````
3432
</RTKCodeSnippet>
3533
<RTKCodeSnippet id="web-angular">
3634

37-
```ts
38-
35+
```ts
3936
const store = meeting.stores.create('myStore');
40-
4137
````
4238
4339
</RTKCodeSnippet>
4440
<RTKCodeSnippet id="web-web-components">
4541
46-
```ts
47-
42+
```ts
4843
const store = meeting.stores.create('myStore');
49-
5044
````
5145
</RTKCodeSnippet>
5246

@@ -129,10 +123,11 @@ For example, if the stored value is `['a', 'b']` and you call `update` with `['c
129123
You can attach event listeners on a store's key, which fire when the value changes.
130124

131125
<RTKCodeSnippet id="web-react">
126+
132127
```ts
133128
const stores = useRealtimeKitSelector((m) => m.stores.stores);
134129
const store = stores.get('myStore');
135-
store.subscribe('key', (data) => {
130+
store.subscribe('key', (data) => {
136131
console.log(data);
137132
});
138133

@@ -142,12 +137,12 @@ console.log(data);
142137
});
143138

144139
store.unsubscribe('key');
145-
146140
````
147141

148142
</RTKCodeSnippet>
149143

150144
<RTKCodeSnippet id="web-angular">
145+
151146
```ts
152147
const { stores } = meeting.stores;
153148
const store = stores.get('myStore');
@@ -167,10 +162,11 @@ store.unsubscribe('key');
167162
</RTKCodeSnippet>
168163
169164
<RTKCodeSnippet id="web-web-components">
165+
170166
```ts
171167
const { stores } = meeting.stores;
172168
const store = stores.get('myStore');
173-
store.subscribe('key', (data) => {
169+
store.subscribe('key', (data) => {
174170
console.log(data);
175171
});
176172

@@ -180,7 +176,6 @@ console.log(data);
180176
});
181177

182178
store.unsubscribe('key');
183-
184179
````
185180

186181
</RTKCodeSnippet>
@@ -190,6 +185,7 @@ store.unsubscribe('key');
190185
You can fetch the data stored in the store:
191186

192187
<RTKCodeSnippet id="web-react">
188+
193189
```ts
194190
const stores = useRealtimeKitSelector((m) => m.stores.stores);
195191
const store = stores.get('myStore');
@@ -204,6 +200,7 @@ const data = store.getAll();
204200
</RTKCodeSnippet>
205201
206202
<RTKCodeSnippet id="web-angular">
203+
207204
```ts
208205
const { stores } = meeting.stores;
209206
const store = stores.get('myStore');
@@ -220,6 +217,7 @@ const data = store.getAll();
220217

221218

222219
<RTKCodeSnippet id="web-web-components">
220+
223221
```ts
224222
const { stores } = meeting.stores;
225223
const store = stores.get('myStore');

0 commit comments

Comments
 (0)