How to use the @apollo-elements/lib/has-all-variables function in @apollo-elements/lib

To help you get started, weโ€™ve selected a few @apollo-elements/lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apollo-elements / apollo-elements / packages / hybrids / apollo-query.js View on Github external
get: host => ({ query = host.query, variables = host.variables } = {}) => {
    if (!hasAllVariables({ query, variables })) return;
    host.observableQuery = host.watchQuery(host, { query });
    const error = onError(host);
    const next = onNext(host);
    return host.observableQuery.subscribe({ error, next });
  },
};
github apollo-elements / apollo-elements / packages / hybrids / apollo-subscription.js View on Github external
get: host => ({
    fetchPolicy = host.fetchPolicy,
    query = host.subscription,
    variables = host.variables,
  } = {}) => {
    if (!hasAllVariables({ query, variables })) return;
    const observable = host.client.subscribe({ fetchPolicy, query, variables });
    const error = host.nextError(host);
    const next = host.nextData(host);
    host.observable = observable;
    return observable.subscribe({ error, next });
  },
};