Looking for reactive Apollo controllers? See @apollo-elements/core
ApolloSubscription
inherits from ApolloElement
and implements the ApolloSubscriptionInterface
.
Read the subscription component guides for examples and tips.
ApolloSubscription
🚀 LitElement base class that updates with an Apollo GraphQL subscription.
See ApolloSubscriptionInterface
for more information on events
Properties
is
static(read-only)string
controller
ApolloController<D, V>
canAutoSubscribe
(read-only)boolean
subscription
ComponentDocument<D, V> | null
noAutoSubscribe
boolean
subscribe
notifyOnNetworkStatusChange
boolean | undefined
shouldResubscribe
boolean
skip
boolean
errorPolicy
C.ErrorPolicy | undefined
fetchPolicy
C.FetchPolicy | undefined
pollInterval
number | undefined
readyToReceiveDocument
boolean
client
ApolloClient<NormalizedCacheObject> | null
document
ComponentDocument<D, V> | null
DocumentNode
context
Record<string, unknown> | undefined
loading
boolean
data
Data<D> | null
variables
Variables<D, V> | null
error
Error | ApolloError | null
errors
readonly GraphQLError[]
Methods
subscribe
Resets the observable and subscribes.Parameters
args
Parameters<this['controller']['subscribe']>
Returns
void
cancel
Cancels and clears the subscriptionReturns
void
shouldSubscribe
Determines whether the element should attempt to subscribe automatically Override to prevent subscribing unless your conditions are metParameters
options
Partial<C.SubscriptionOptions<Variables<D, V>, Data<D>>>
Returns
boolean
onSubscriptionData
Callback for when data is updatedParameters
result
OnSubscriptionDataParams<Data<D>>
Returns
void
onError
Callback for when error is updatedParameters
error
C.ApolloError
Returns
void
onSubscriptionComplete
Callback for when subscription completes.Returns
void
Events
apollo-element-connected
ApolloElementEvent
apollo-element-disconnected
ApolloElementEvent
Exports
js ApolloSubscription
from apollo-subscription.js