Skip to content

Commit

Permalink
docs: ✏️ update docs and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisermann committed Jan 14, 2020
1 parent af7d936 commit b054792
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -20,7 +20,7 @@ Just pass a `loader` method which return a async module import:
- `delay`: minimum delay in `msecs` for showing the `loading slot`. Default: 200
- `timeout`: time in `msecs` for showing the `timeout slot`.

Any other prop will be passed directly onto the rendered component if no `success` slot is defined:
Any other prop will be passed directly onto the rendered component if the `default` slot is defined:

```html
<Loadable loader="{...}" foo="cookie" bar="potato" />
Expand Down
19 changes: 3 additions & 16 deletions example/src/App.svelte
Expand Up @@ -30,12 +30,10 @@
</div>
</Loadable>

<h1>This one will work with custom props by using the "success" slots</h1>
<Loadable loader={getDelayedLoader()}>
<h1>This one will work with custom props by using the "default" slots</h1>
<Loadable loader={getDelayedLoader()} let:component>
<div slot="loading">Loading and blessed to succeed...</div>
<div slot="success" let:component>
<svelte:component this={component} customProp={true} />
</div>
<svelte:component this={component} customProp={true} />
</Loadable>

<h1>
Expand All @@ -46,17 +44,6 @@
<div slot="loading">Loading and blessed to succeed...</div>
</Loadable>

<h1>
This one will work with custom props by passing props to the Loadable
component and getting it in the success slot
</h1>
<Loadable loader={getDelayedLoader()} customProp={false}>
<div slot="loading">Loading and blessed to succeed...</div>
<div slot="success" let:component let:props>
<svelte:component this={component} customProp={props.customProp} />
</div>
</Loadable>

<h1>This one will timeout</h1>
<Loadable loader={getDelayedLoader(7000)} timeout="3000">
<div slot="loading">Loading...</div>
Expand Down

0 comments on commit b054792

Please sign in to comment.