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
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 ApolloElementMixinApolloClient<NormalizedCacheObject> | null
The Apollo Client instance.
context
inherited from ApolloElementMixinRecord<string, unknown> | undefined
Context passed to the link execution chain.
controller
inherited from ApolloElementMixinApolloController<D, V>
data
inherited from ApolloElementMixinData<D> | null
Latest data
Latest subscription data.
document
inherited from ApolloElementMixinComponentDocument<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 ApolloElementMixinError | ApolloError | null
Latest error.
errorPolicy
inherited from ApolloElementMixin error-policyErrorPolicy | 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 callnext
all
: errors are treated like data and will notify observables
errors
inherited from ApolloElementMixinreadonly GraphQLError[]
Latest errors.
fetchPolicy
inherited from ApolloElementMixinstring | undefined
Fetch Policy for the operation.
loading
inherited from ApolloElementMixinboolean
Whether a request is in-flight.
readyToReceiveDocument
inherited from ApolloElementMixinboolean
True when the element is connected and ready to receive its GraphQL document
updateComplete
inherited from ControllerHostMixinPromise<boolean>
variables
inherited from ApolloElementMixinVariables<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
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
cancel
Returns
void
addController
inherited from ControllerHostMixinParameters
controller
ReactiveController
Returns
void
removeController
inherited from ControllerHostMixinParameters
controller
ReactiveController
Returns
void
requestUpdate
inherited from ControllerHostMixinReturns
void
update
inherited from ControllerHostMixinParameters
args
any[]
updated
inherited from ControllerHostMixinParameters
args
any[]
Events
Name | Type | Description |
---|---|---|
apollo-element-connected |
|
|
apollo-element-disconnected |
|
Private API
Private Properties
#controllers
inherited from ControllerHostMixin
#resolve
inherited from ControllerHostMixin(v: boolean) => void
#updateComplete
inherited from ControllerHostMixin
#updatePending
inherited from ControllerHostMixinboolean
Private Methods
documentChanged
inherited from ApolloElementMixinLifecycle callback that reacts to changes in the GraphQL document.
Parameters
document
this['document']
The GraphQL document.
Returns
void
doUpdate
inherited from ControllerHostMixinvariablesChanged
inherited from ApolloElementMixinLifecycle 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';