<link rel="stylesheet" href="/_merged_assets/_static/search/noscript.css">
Apollo Elements Apollo Elements Guides API Blog Toggle darkmode

Class Mixins: ApolloSubscriptionMixin

ApolloSubscriptionMixin applies ApolloElementMixin and the ApolloSubscriptionInterface.

Read the subscription component guides for examples and tips.

Attributes

no-auto-subscribe


fetch-policy

inherited from ApolloElementMixin

Signature

ApolloSubscriptionMixin

Parameters

superclass

B

Properties

static

documentType

inherited from ApolloElementMixin
'document'|'query'|'mutation'|'subscription'

subscription

ComponentDocument<D, V> | null

skip

boolean

shouldResubscribe

SubscriptionDataOptions['shouldResubscribe']

pollInterval

number | undefined

notifyOnNetworkStatusChange

boolean | undefined

noAutoSubscribe


canAutoSubscribe

boolean

client

inherited from ApolloElementMixin
ApolloClient<NormalizedCacheObject> | null

The Apollo Client instance.

context

inherited from ApolloElementMixin
Record<string, unknown> | undefined

Context passed to the link execution chain.

controller

inherited from ApolloElementMixin
ApolloController<D, V>

data

inherited from ApolloElementMixin
Data<D> | null

Latest data

Latest subscription data.

document

inherited from ApolloElementMixin
ComponentDocument<D, V> | null

Operation document. A GraphQL document containing a single query, mutation, or subscription. You can set it as a JavaScript property or by appending a GraphQL script to the element (light DOM).

error

inherited from ApolloElementMixin
Error | ApolloError | null

Latest error.

errorPolicy

inherited from ApolloElementMixin error-policy
ErrorPolicy | undefined

Error Policy for the operation.

errorPolicy determines the level of events for errors in the execution result. The options are:

  • none (default): any errors from the request are treated like runtime errors and the observable is stopped (XXX this is default to lower breaking changes going from AC 1.0 => 2.0)
  • ignore: errors from the request do not stop the observable, but also don't call next
  • all: errors are treated like data and will notify observables

errors

inherited from ApolloElementMixin
readonly GraphQLError[]

Latest errors.

fetchPolicy

inherited from ApolloElementMixin
string | undefined

Fetch Policy for the operation.

loading

inherited from ApolloElementMixin
boolean

Whether a request is in-flight.

public

readyToReceiveDocument

inherited from ApolloElementMixin
boolean

True when the element is connected and ready to receive its GraphQL document

updateComplete

inherited from ControllerHostMixin
Promise<boolean>

variables

inherited from ApolloElementMixin
Variables<D, V> | null

Subscription variables.

An object map from variable name to variable value, where the variables are used within the GraphQL subscription.

Setting variables will initiate the subscription, unless noAutoSubscribe is also set.

Methods

public

subscribe

Parameters

params

Partial<SubscriptionDataOptions<D, V>>

Returns

void

shouldSubscribe

Determines whether the element should attempt to subscribe automatically Override to prevent subscribing unless your conditions are met

Parameters

options

Partial<C.SubscriptionOptions<Variables<D, V>, Data<D>>>

Returns

boolean

onSubscriptionData

Parameters

_result

OnSubscriptionDataParams<Data<D>>

Returns

void

onSubscriptionComplete

Returns

void

onError

Parameters

error

C.ApolloError

Returns

void
public

cancel

Returns

void

addController

inherited from ControllerHostMixin

Parameters

controller

ReactiveController

Returns

void

removeController

inherited from ControllerHostMixin

Parameters

controller

ReactiveController

Returns

void

requestUpdate

inherited from ControllerHostMixin

Returns

void

update

inherited from ControllerHostMixin

Parameters

args

any[]

updated

inherited from ControllerHostMixin

Parameters

args

any[]

Events

Name Type Description
apollo-element-connected
ApolloElementEvent
apollo-element-disconnected
ApolloElementEvent
Private API

Private Properties

private

#controllers

inherited from ControllerHostMixin

private

#resolve

inherited from ControllerHostMixin
(v: boolean) => void
private

#updateComplete

inherited from ControllerHostMixin

private

#updatePending

inherited from ControllerHostMixin
boolean

Private Methods

protected

documentChanged

inherited from ApolloElementMixin

Lifecycle callback that reacts to changes in the GraphQL document.

Parameters

document

this['document']

The GraphQL document.

Returns

void
private

doUpdate

inherited from ControllerHostMixin
protected

variablesChanged

inherited from ApolloElementMixin

Lifecycle callback that reacts to changes in the operation variables.

Parameters

variables

this['variables']

The variables.

Returns

void

Exports

import { ApolloSubscriptionMixin } from '@apollo-elements/mixins/apollo-subscription-mixin';