How to use the @apollo-elements/mixins/apollo-subscription-mixin.js.ApolloSubscriptionMixin function in @apollo-elements/mixins

To help you get started, weโ€™ve selected a few @apollo-elements/mixins 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 / lit-apollo / apollo-subscription.js View on Github external
*     return (
 *         loading ? html``
 *       : error ? errorTemplate(error)
 *       : html`<p>${data.helloWorld.greeting}, ${data.helloWorld.name}</p>`
 *     );
 *   }
 * };
 *
 * customElements.define('connected-element', ConnectedElement)
 * ```
 *
 * @polymer
 * @extends ApolloElement
 * @appliesMixin ApolloSubscriptionMixin
 */
export class ApolloSubscription extends ApolloSubscriptionMixin(ApolloElement) {
  /**
   * By default, will only render if
   *   - The component has `data` or
   *   - The component has an `error` or
   *   - The component is `loading`.
   *
   * @param  {Map}  changedProps           Changed properties.
   * @return {boolean}                     Whether the component should render.
   * @protected
   */
  shouldUpdate() {
    return (
      this.loading != null ||
      !!this.error ||
      !!this.data
    );
github apollo-elements / apollo-elements / packages / polymer / apollo-subscription.js View on Github external
*       
 *     
 *
 *     
 *       [[data.userJoined.picture]]
 *     
 *   `;
 * }
 * ```
 *
 * @polymer
 * @customElement
 * @extends ApolloSubscription
 * @appliesMixin NotifyingElementMixin
 */
const ApolloSubscription = ApolloSubscriptionMixin(class extends Notify(HTMLElement) {
  /**
   * Latest data.
   *
   * @type {Object}
   */
  get data() {
    return this.__data;
  }

  set data(value) {
    this.__data = value;
    this.notify('data', value);
  }

  /**
   * Latest error.
github apollo-elements / apollo-elements / packages / gluon / apollo-subscription.js View on Github external
*     return (
 *         loading ? html``
 *       : error ? errorTemplate(error)
 *       : html`<p>${data.helloWorld.greeting}, ${data.helloWorld.name}</p>`
 *     )
 *   }
 * };
 *
 * customElements.define('connected-element', ConnectedElement)
 * ```
 *
 * @polymer
 * @extends ApolloElement
 * @appliesMixin ApolloSubscriptionMixin
 */
export class ApolloSubscription extends ApolloSubscriptionMixin(ApolloElement) { }