Options
All
  • Public
  • Public/Protected
  • All
Menu
element

apollo-client

Provides an ApolloClient instance to all nested ApolloElement children, even across (open) shadow boundaries.

example

Providing a client to a tree of Nodes

<apollo-client id="client-a">
  <apollo-mutation>
    <!--...-->
  </apollo-mutation>
</apollo-client>
example

Nesting separate clients

<apollo-client id="client-a">
  <query-element>
    <!-- This element queries from client-a's endpoint -->
  </query-element>
  <apollo-client id="client-b">
    <query-element>
      <!-- This element queries from client-b's endpoint -->
    </query-element>
  </apollo-client>
</apollo-client>

Hierarchy

Index

Constructors

constructor

Properties

Private #instances

#instances: Set<ApolloElement> = new Set()

Private cache of child ApolloElements

Accessors

client

instances

  • Set of elements subscribed to changes on this element's client

    Returns Set<ApolloElement>

Methods

connectedCallback

  • connectedCallback(): void
  • Returns void

Private findDeepInstances

  • findDeepInstances(): void
  • Returns void

Private initialize

  • Set the client on the element, and if it's a query or subscription element, attemp to subscribe

    Parameters

    Returns void

Private onElementConnected

  • Assigns the element's client instance to the child, and registers the child to receive the element's new client when its set.

    Parameters

    Returns void

Private onElementDisconnected

  • Performs clean up when the child disconnects

    Parameters

    Returns void