1 | /**
|
2 | * The current status of a query’s execution in our system.
|
3 | */
|
4 | export var NetworkStatus;
|
5 | (function (NetworkStatus) {
|
6 | /**
|
7 | * The query has never been run before and the query is now currently running. A query will still
|
8 | * have this network status even if a partial data result was returned from the cache, but a
|
9 | * query was dispatched anyway.
|
10 | */
|
11 | NetworkStatus[NetworkStatus["loading"] = 1] = "loading";
|
12 | /**
|
13 | * If `setVariables` was called and a query was fired because of that then the network status
|
14 | * will be `setVariables` until the result of that query comes back.
|
15 | */
|
16 | NetworkStatus[NetworkStatus["setVariables"] = 2] = "setVariables";
|
17 | /**
|
18 | * Indicates that `fetchMore` was called on this query and that the query created is currently in
|
19 | * flight.
|
20 | */
|
21 | NetworkStatus[NetworkStatus["fetchMore"] = 3] = "fetchMore";
|
22 | /**
|
23 | * Similar to the `setVariables` network status. It means that `refetch` was called on a query
|
24 | * and the refetch request is currently in flight.
|
25 | */
|
26 | NetworkStatus[NetworkStatus["refetch"] = 4] = "refetch";
|
27 | /**
|
28 | * Indicates that a polling query is currently in flight. So for example if you are polling a
|
29 | * query every 10 seconds then the network status will switch to `poll` every 10 seconds whenever
|
30 | * a poll request has been sent but not resolved.
|
31 | */
|
32 | NetworkStatus[NetworkStatus["poll"] = 6] = "poll";
|
33 | /**
|
34 | * No request is in flight for this query, and no errors happened. Everything is OK.
|
35 | */
|
36 | NetworkStatus[NetworkStatus["ready"] = 7] = "ready";
|
37 | /**
|
38 | * No request is in flight for this query, but one or more errors were detected.
|
39 | */
|
40 | NetworkStatus[NetworkStatus["error"] = 8] = "error";
|
41 | })(NetworkStatus || (NetworkStatus = {}));
|
42 | /**
|
43 | * Returns true if there is currently a network request in flight according to a given network
|
44 | * status.
|
45 | */
|
46 | export function isNetworkRequestInFlight(networkStatus) {
|
47 | return networkStatus ? networkStatus < 7 : false;
|
48 | }
|
49 | /**
|
50 | * Returns true if the network request is in ready or error state according to a given network
|
51 | * status.
|
52 | */
|
53 | export function isNetworkRequestSettled(networkStatus) {
|
54 | return networkStatus === 7 || networkStatus === 8;
|
55 | }
|
56 | //# sourceMappingURL=networkStatus.js.map |
\ | No newline at end of file |