greed-vue

0.2.1 • Public • Published

Greed-Vue

Greed Container for Vue

Travis Codecov branch version downloads Donate MIT License

This modules purpose is to provide a more intimate abstraction for creating queries and mutations in vue applications. This module itself uses the greed module under the covers. Hopefully this abstraction lends itself well to you when knee deep in application level code.

Install

npm install --save greed-vue

Usage

import Vue from 'vue';
import pot from './greedInstance.js';
import { container } from 'greed-vue';
 
function someComponent () {
  ...
}
 
//default
export default container(
  someComponent,
  containerDefaults(props),
  containerQueries(props),
  containerMutations(props)
);
 
function containerDefaults (props) {
  return {
    vars: {
      id: 0
    },
    count: gql`
      count: (id: $id){
        count
      }
    `
  };
}
 
function containerQueries (props) {
  return {
    vars: {
      id: 0
    },
    loadMoreCounts: gql`
      count: (id: $id){
        count
      }
    `
  };
}
 
function containerMutations (props) {
  return {
    vars: {
      id: 0
    },
    incrementCount (handler) {
      gql`
        count: (id: $id){
          count
        }
      `;
      return handler(result);
    },
    decrementCount (handler) {
      gql`
        count: (id: $id){
          count
        }
      `;
      return handler(result);
    }
  };
}

Readme

Keywords

Package Sidebar

Install

npm i greed-vue

Weekly Downloads

2

Version

0.2.1

License

MIT

Last publish

Collaborators

  • kennetpostigo