apollo-link-electron-ipc
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

apollo-link-electron-ipc

In electron, forward GraqhQL operations to the main process

NPM Version

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

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i apollo-link-electron-ipc

Weekly Downloads

1

Version

1.1.1

License

MIT

Unpacked Size

9.22 kB

Total Files

17

Last publish

Collaborators

  • alexstrat