chore: update readme
This commit is contained in:
parent
c98d9ef6c8
commit
c67bdd41d0
1 changed files with 31 additions and 1 deletions
30
README.md
30
README.md
|
@ -4,3 +4,33 @@ Utilities for serializing data from server for use in the client.
|
|||
|
||||
1. `Resumable` Astro component takes `id` and `data`
|
||||
1. `resume(id: string): Object` function for use int he client takes an `id` string and returns the `data` as Object
|
||||
|
||||
## Intallation
|
||||
|
||||
```
|
||||
npm i @ayco/astro-resume
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```astro
|
||||
---
|
||||
import Resumable from '../Resumable.astro';
|
||||
const data = {
|
||||
hello: 'world'
|
||||
}
|
||||
---
|
||||
|
||||
<Resumable id="astro-obj" data={data} />
|
||||
|
||||
<div id="render-here"></div>
|
||||
|
||||
<script>
|
||||
import resume from '../resume';
|
||||
console.log(resume('astro-obj'));
|
||||
const renderDiv = document.querySelector('#render-here');
|
||||
if (renderDiv) {
|
||||
renderDiv.innerHTML = JSON.stringify(resume('astro-obj'))
|
||||
}
|
||||
</script>
|
||||
```
|
Loading…
Reference in a new issue