Controllers: ApolloController
ApolloController
is the abstract base class at the heart of Apollo Elements. You should not import ApolloController
directly, instead use the subclasses: ApolloQueryController
, ApolloMutationController
, and ApolloSubscriptionController
.
Properties
variables
Variables<D, V> | null
Variables for the operation.
options
ApolloControllerOptions<D, V>
Options for the operation and controller.
loading
boolean
Whether a request is in-flight.
errors
readonly GraphQLError[]
Latest errors from the operation, or []
.
error
ApolloError | null
Latest error from the operation, or null
.
document
ComponentDocument<D> | null
The GraphQL document for the operation.
data
Data<D> | null
Latest data for the operation, or null
.
client
ApolloClient<NormalizedCacheObject> | null
The ApolloClient
instance for this controller.
called
boolean
Methods
hostDisconnected
Returns
void
hostConnected
Returns
void
Private API
Private Properties
emitter
EventTarget
The event emitter to use when firing events, usually the host element.
#options
ApolloControllerOptions<D, V>
#document
ComponentDocument<D> | null
#client
ApolloClient<NormalizedCacheObject> | null
Private Methods
variablesChanged
callback for when the GraphQL variables change.
Parameters
variables
Variables<D, V> | null
Returns
void
notify
Notifies about updated properties.
Parameters
keys
(keyof this)[]
Returns
void
init
Assigns the controller's variables and GraphQL document.
Parameters
document
ComponentDocument<D> | null
Returns
void
documentChanged
callback for when the GraphQL document changes.
Parameters
document
ComponentDocument<D> | null
Returns
void
clientChanged
callback for when the Apollo client changes.
Parameters
client
ApolloClient<NormalizedCacheObject> | null
Returns
void
[update]
requests an update on the host.
Parameters
properties
Record<string, unknown>
Returns
void
Exports
import { update, ApolloController } from '@apollo-elements/core/apollo-controller';