<link rel="stylesheet" href="/_merged_assets/_static/search/noscript.css">
Apollo Elements Apollo Elements Guides API Blog Toggle darkmode

Class Mixins: GraphQLScriptChildMixin

GraphQLScriptChildMixin allows Apollo elements to read their GraphQL document (i.e. query, mutation, or subscription) and variables from HTML <script type="application/graphql"> or <script type="application/json"> elements

Signature

GraphQLScriptChildMixin

Parameters

superclass

B
Private API

Private Properties

private

mo

MutationObserver | undefined

Updates the element state in reaction to GraphQL or JSON script child changes.

Private Methods

private

parseVariables

Parameters

text

string

Returns

this['variables']
private

parseGQL

Parameters

text

string

Returns

this['document']
private

onDOMMutation

Update the element state in reaction to DOM updates that change the declarative GraphQL document or JSON-variable scripts

Parameters

records

MutationRecord[]

Returns

void
private

matchNode

When encountering a DOM Mutation, update the element's state if relevant.

Parameters

node

Node

Returns

Promise<void>
protected

getDOMVariables

Gets operation variables from the element's JSON script child

Returns

this['variables']
protected

getDOMGraphQLDocument

Get a GraphQL DocumentNode from the element's GraphQL script child

Returns

Promise<this['document']>
private

fetchDocument

Parameters

url

string

Returns

Promise<this['document']>

Exports

import { GraphQLScriptChildMixin } from '@apollo-elements/mixins/graphql-script-child-mixin';