8000 chore: update readme · wheatjs/vite-plugin-vue-gql@798f546 · GitHub
[go: up one dir, main page]

Skip to content

Commit 798f546

Browse files
committed
chore: update readme
1 parent 55e9eec commit 798f546

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,34 @@ mutation($name: String!) {
159159
</gql>
160160
```
161161

162+
**Subscriptions**
163+
```html
164+
<script setup lang="ts">
165+
import { ref } from 'vue'
166+
import { useSubscription } from 'vql'
167+
168+
const isPaused = ref(false)
169+
const handleSubscription = (messages = [], response) => {
170+
return [response.newMessages, ...messages]
171+
}
172+
173+
const { data } = useSubscription({ from: 'Eren' }, { pause: isPaused }, handleSubscription)
174+
</script>
175+
176+
<template>...</template>
177+
178+
<gql mutation>
179+
subscription MessageSub($from: String!) {
180+
newMessages(from: $from) {
181+
id
182+
from
183+
text
184+
}
185+
}
186+
</gql>
187+
```
188+
189+
162190
## Roadmap
163191
- [ ] Add support for fragments
164192
- [ ] Investigate automatically generating queries from SFC templates

0 commit comments

Comments
 (0)
0