UNPKG

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