Package Exports
- @apollo-elements/mixins
- @apollo-elements/mixins/apollo-element-mixin
- @apollo-elements/mixins/apollo-element-mixin.js
- @apollo-elements/mixins/apollo-mutation-mixin
- @apollo-elements/mixins/apollo-mutation-mixin.js
- @apollo-elements/mixins/apollo-query-mixin
- @apollo-elements/mixins/apollo-query-mixin.js
- @apollo-elements/mixins/apollo-subscription-mixin
- @apollo-elements/mixins/apollo-subscription-mixin.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@apollo-elements/mixins) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@apollo-elements/mixins
🍹 Moon mixins for cosmic components 👩🚀
A set of class mixin functions that add Apollo GraphQL goodness to your web component classes.
📓 Contents
🔧 Installation
Apollo element mixins are distributed through npm, the node package manager. To install a copy of the latest version in your project's node_modules directory, install npm on your system then run the following command in your project's root directory:
npm install --save @apollo-elements/mixinsHere's an example that uses HTMLElement
import { ApolloQueryMixin } from '@apollo-elements/mixins/apollo-query-mixin.js';
class VanillaQuery extends ApolloQueryMixin(HTMLElement) {
get data() {
return this.__data;
}
set data(data) {
this.__data = data;
this.shadowRoot.innerText = `${data.helloWorld.greeting}, ${data.helloWorld.name}`;
}
}😎 Cool Tricks
📜 Inline Query Scripts
You can also provide a graphql query string in your markup by appending a graphql script element to your connected element, like so:
<connected-element>
<script type="application/graphql">
query {
helloWorld {
name
greeting
}
}
</script>
</connected-element>👷♂️ Maintainers
apollo-elements is a community project maintained by Benny Powers.