Add to store page

pull/8452/head
Puru Vijay 3 years ago
parent 218849c3ec
commit 9f99679ebb

@ -10,6 +10,8 @@ This makes it possible to wrap almost any other reactive state handling library
## `writable`
> EXPORT_SNIPPET: svelte/store#writable
```js
store = writable(value?: any)
```
@ -61,6 +63,8 @@ Note that the value of a `writable` is lost when it is destroyed, for example wh
## `readable`
> EXPORT_SNIPPET: svelte/store#readable
```js
store = readable(value?: any, start?: (set: (value: any) => void) => () => void)
```
@ -84,6 +88,8 @@ const time = readable(null, (set) => {
## `derived`
> EXPORT_SNIPPET: svelte/store#derived
```js
store = derived(a, callback: (a: any) => any)
```
@ -160,6 +166,8 @@ const delayed = derived([a, b], ([$a, $b], set) => {
## `readonly`
> EXPORT_SNIPPET: svelte/store#readonly
```js
readableStore = readonly(writableStore);
```
@ -180,6 +188,8 @@ readableStore.set(2); // ERROR
## `get`
> EXPORT_SNIPPET: svelte/store#get
```js
value: any = get(store);
```

@ -68,11 +68,15 @@ export function replace_placeholders(content) {
const module = modules.find((module) => module.name === name);
if (!module) throw new Error(`Could not find module ${name}`);
if (id) {
const exported = module.exports.find((t) => t.name === id);
return `<div class="ts-block">${fence(exported.snippet)}</div>`;
if (!id) {
throw new Error(`id is required for module ${name}`);
}
const exported = module.exports.filter((t) => t.name === id);
return exported
.map((exportVal) => `<div class="ts-block">${fence(exportVal.snippet)}</div>`)
.join('\n\n');
})
.replace('> MODULES', () => {
return modules

Loading…
Cancel
Save