apollo-link-electron-ipc
v1.1.1
Published
In electron, forward GraqhQL operations to the main process
Downloads
4
Readme
apollo-link-electron-ipc
In electron, forward GraqhQL operations to the main process
Install
npm i -S apollo-link-electron-ipc
Usage
// in main
import { createElectronRPCGraphQLRequestExecutor } from 'apollo-link-electron-ipc';
import { HttpLink } from 'apollo-link-http';
import fetch from 'electron-fetch';
// example with HttpLink
createElectronRPCGraphQLRequestExecutor({
link: new HttpLink({
uri: 'your-endpoint',
fetch
})
});
// in renderer
import { createElectronRPCLink } from 'apollo-link-electron-ipc';
import { ApolloClient } from 'apollo-client';
import { InMemoryCache } from 'apollo-cache-inmemory';
const client = new ApolloClient({
link: createElectronRPCLink(),
cache: new InMemoryCache(),
});
client.query(MY_QUERY);
Streaming link
⚠️ apollo-link-electron-ipc supports ObservableQueries
with streaming links, but requires to instantiate ApolloClient
with option queryDeduplication: false,
. See apollographql/apollo-client#4322