2.1.3 • Published 4 years ago

@sidy/vue-shimio-graphql v2.1.3

Weekly downloads
3
License
UNLICENSE
Repository
github
Last release
4 years ago

Install

import graphql from '@sidy/vue-shimio-graphql'

Vue.use(graphql, {
  name: 'graphql', // vue prototype namespace
  hosts: [{
      name: 'Api',
      endpoint: 'ws://0.0.0.0:3000', // this.$graphql.Api.query('{ ping }')
      retry_strategy: () => 2000,
      on_connect: () => {},
      on_disconnect: () => {}
    }, {
      name: 'Auth',
      endpoint: 'ws://0.0.0.0:3001',
    }]
})

Usage in components

<template lang="pug">
    <Api query="query BLABLABLA { }" ref="api">
      <template #loading>
        Loading.. (v-if loading)
      </template>

      <template #BLABLABLA="{ operation }"> <!-- see @hydre/shimio-graphql -->
        The `foo` operation
      </template>

      <template #none="{ operation }"> <!-- in case of early error -->
        a `none` operation
      </template>

      <template #anon="{ operation }"> <!-- in case of unnamed query -->
        an `anon` operation
      </template>

      <template #all="{ operations }"> <!-- [name, operation] = operations -->
        All operation (always active)
      </template>
</template>

Hybrid usage (recommended over raw js)

<template lang="pug">
    <Api
      query="query foo { }" ref="api"
      @foo="operation => { }"
    />
</template>

Usage in raw js

const { query, disconnect } = Vue.prototype.$graphql.Auth
const queried = await query('{ ping }') // run some queries
const result = await queried.once() // get one result and abort
for await (const operation of queried.listen()) { // or iterate and listen
  result.stop() // unsubscribe from the operation
}
2.1.2

4 years ago

2.1.1

4 years ago

2.1.3

4 years ago

2.1.0

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.14

4 years ago

2.0.0

4 years ago

1.1.13

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago