This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<q-virtual-scroll | |
style="max-height: 300px; overflow-x: hidden" | |
:items-size="size" | |
:items-fn="getItems" | |
:virtual-scroll-item-size="78" | |
separator | |
> | |
<template v-slot="{ item, index }"> | |
<some-component :key="index" :index="item.index" :sent="item.sent" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apolloClientConfigObj.cache.writeData({ | |
data: { | |
todos: [], | |
networkStatus: { | |
__typename: 'NetworkStatus', | |
isConnected: false | |
}, | |
filters: [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="q-pa-sm text-center"> | |
<q-btn | |
color="primary" | |
v-for="(filter, index) in filters" | |
:flat="!filter.active" | |
:key="index" | |
@click="setFilter(filter.name)" | |
> | |
{{ filter.label }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div style="width: 300px"> | |
<q-list bordered separator v-if="todos.length"> | |
<q-item v-for="todo in visibleTodos" :key="todo.id"> | |
<Todo :todo="todo" /> | |
</q-item> | |
</q-list> | |
<p v-else class="text-center"> Add some tasks and let's get some work done! </p> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<ApolloQuery | |
:query="gql => gql` | |
query GetTodos { | |
todos @client { | |
id | |
text | |
completed | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<q-checkbox | |
v-model="todoToggle" | |
@input="setToggle" | |
/> | |
<p v-if="error">There has been an error<br>{{error}}</p> | |
</div> | |
</template> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<ApolloMutation | |
:mutation="mutation" | |
:update="updateCache" | |
> | |
<template v-slot="{ mutate, loading, error }"> | |
<q-checkbox | |
v-model="todoToggle" | |
@input="mutate" | |
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
... | |
</template> | |
<script> | |
... | |
methods: { | |
updateCache (store, { data: { toggleTodo } }) { | |
const id = `TodoItem:${this.id}` | |
const fragment = queries.toggleTodoFragment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "quasar-todo-extension", | |
"description": "A Quasar web browser extension for bookmarking and adding todos.", | |
"version": "1.0.0", | |
"manifest_version": 2, | |
"icons": { | |
"16": "icons/icon16x16.png", | |
"48": "icons/icon48x48.png", | |
"128": "icons/icon128x128.png" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function attachBackgroundHooks (bridge, allActiveConnections) { | |
bridge.on('storage.get', event => { | |
const payload = event.data | |
if (payload.key === null) { | |
chrome.storage.local.get(null, r => { | |
const result = [] | |
// Group the items up into an array to take advantage of the bridge's chunk splitting. | |
for (const itemKey in r) { | |
result.push(r[itemKey]) |