0.0.0-main-31f24c70 • Published 2 months ago
atl-relay-runtime v0.0.0-main-31f24c70
Relay Runtime
A set of Relay APIs responsible for data fetching, reading and normalization of the GraphQL data.
Example:
// @flow strict-local
import type {FetchFunction} from 'relay-runtime';
const {
Environment,
Network,
Observable,
RecordSource,
Store,
fetchQuery,
graphql,
} = require('relay-runtime');
const fetchFn: FetchFunction = function (request, variables) {
return new Observable.create(source => {
fetch('/my-graphql-api', {
method: 'POST',
body: JSON.stringify({
text: request.text,
variables,
}),
})
.then(response => response.json())
.then(data => source.next(data));
});
};
const network = Network.create(fetchFn);
const store = new Store(new RecordSource());
const environment = new Environment({
network,
store,
});
fetchQuery(
environment,
graphql`
query AppQuery($id: ID!) {
user(id: $id) {
name
}
}
`,
{id: 'my-node-id'},
).subscribe({
error: error => {
console.error(error);
},
next: data => {
console.log(data);
},
});
For complete API reference, visit https://relay.dev/.
0.0.0-main-307171f4
2 months ago
0.0.0-main-7576e2c4
7 months ago
0.0.0-main-a41dab2f
7 months ago
0.0.0-main-322a3fb0
7 months ago
0.0.0-main-86d355c1
11 months ago
0.0.0-main-8caa9335
1 year ago
0.0.0-main-d9b797a8
1 year ago
0.0.0-main-d7d54856
1 year ago
0.0.0-main-ee494615
2 years ago
0.0.0-main-d8940380
1 year ago
0.0.0-main-15d4f51f
2 years ago
0.0.0-main-df163556
1 year ago
0.0.0-main-2fdd0cd4
2 years ago
0.0.0-main-96a86e2c
2 years ago
0.0.0-main-d2fd8542
2 years ago
0.0.0-main-0acb179c
2 years ago
0.0.0-main-16251cbf
2 years ago
0.0.0-main-a011e2ef
2 years ago
0.0.0-main-dca70be3
2 years ago
0.0.0-main-7a7c269a
2 years ago
0.0.0-main-ae9a46b8
2 years ago
0.0.0-main-095491e5
2 years ago
0.0.0-main-f5877bfe
2 years ago
0.0.0-main-accde866
2 years ago
0.0.0-main-41a286f0
2 years ago
0.0.0-main-31f24c70
2 years ago