Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ApolloSubscriptionElement<D, V, TData, TVariables>

Type parameters

  • D

  • V

  • TData

  • TVariables

Hierarchy

Implements

Index

Constructors

constructor

Properties

Private __document

__document: DocumentNode = null

Private __mo

Private __variables

__variables: TVariables = null

client

client: ApolloClient<NormalizedCacheObject> = window.__APOLLO_CLIENT__

Optional context

context: Record<string, unknown>

data

data: TData

error

errors

errors: readonly GraphQLError[]

fetchPolicy

fetchPolicy: FetchPolicy

fetchResults

fetchResults: boolean

loading

loading: boolean

noAutoSubscribe

noAutoSubscribe: boolean

notifyOnNetworkStatusChange

notifyOnNetworkStatusChange: boolean = false

observable

observable: Observable<FetchResult<TData>>

observableSubscription

observableSubscription: Subscription

pollInterval

pollInterval: number

skip

skip: boolean

subscription

subscription: DocumentNode

variables

variables: TVariables

Accessors

document

Methods

Optional adoptedCallback

  • adoptedCallback(): void

Optional attributeChangedCallback

  • attributeChangedCallback(name: string, oldValue: string, newValue: string): void
  • Called when one of the element's observedAttributes changes.

    Parameters

    • name: string

      name of the observed attribute

    • oldValue: string

      previous value of the attribute. null if it was nonexistent

    • newValue: string

      current value of the attribute. null if removed.

    Returns void

Protected canSubscribe

  • canSubscribe(options?: Partial<SubscriptionOptions>): boolean
  • Determines whether the element is able to automatically subscribe

    Parameters

    • Optional options: Partial<SubscriptionOptions>

    Returns boolean

cancel

  • cancel(): void

Protected connectedCallback

  • connectedCallback(): void

Protected disconnectedCallback

  • disconnectedCallback(): void

Private endSubscription

  • endSubscription(): void

Private initObservable

Private nextData

  • nextData(result: FetchResult<TData>): void
  • Sets data, loading, and error on the instance when new subscription results arrive.

    Parameters

    • result: FetchResult<TData>

    Returns void

Private nextError

  • Sets error and loading on the instance when the subscription errors.

    Parameters

    Returns void

Private onComplete

  • onComplete(): void
  • Shuts down the subscription

    Returns void

Optional onError

Optional onSubscriptionComplete

  • onSubscriptionComplete(): void

Optional onSubscriptionData

shouldSubscribe

  • shouldSubscribe(options?: Partial<SubscriptionOptions>): boolean
  • Determines whether the element should attempt to automatically subscribe i.e. begin querying

    Override to prevent subscribing unless your conditions are met.

    Parameters

    • Optional options: Partial<SubscriptionOptions>

    Returns boolean

subscribe