Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ApolloElement<TData, TVariables>

ApolloElement

🚀 Custom element base class for Apollo FAST elements.

See ApolloElementInterface for more information on events

element

Type parameters

  • TData

  • TVariables

Hierarchy

Implements

Index

Properties

Private _document

_document: DocumentNode | null = null

Private _documentSetByJS

_documentSetByJS: boolean = false

Private _variables

_variables: TVariables | null = null

Private _variablesSetByJS

_variablesSetByJS: boolean = false

client

client: ApolloClient<NormalizedCacheObject> | null = window.__APOLLO_CLIENT__ ?? null

Optional context

context: Record<string, unknown>

data

data: TData | null = null

error

error: ApolloError | Error | null = null

errors

errors: readonly GraphQLError[] | null = null

loading

loading: boolean = false

Private mo

mo: MutationObserver | null = null

variables

variables: TVariables

Static documentType

documentType: string = "document"

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

connectedCallback

  • connectedCallback(): void

disconnectedCallback

  • disconnectedCallback(): void

Optional Protected documentChanged

Private getDOMGraphQLDocument

Private getDOMVariables

  • getDOMVariables(): TVariables | null
  • Gets operation variables from the element's JSON script child

    Returns TVariables | null

Private onDOMMutation

  • onDOMMutation(records: MutationRecord[]): void

Optional Protected variablesChanged

  • variablesChanged(variables: TVariables | null): void
  • Lifecycle callback that reacts to changes in the operation variables

    Parameters

    • variables: TVariables | null

    Returns void