@hyper-fetch/core 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +3 -3
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +3 -3
- package/dist/managers/app/app.manager.d.ts +1 -1
- package/dist/request/request.d.ts +1 -1
- package/package.json +2 -2
- package/src/adapter/adapter.ts +1 -1
- package/src/managers/app/app.manager.ts +2 -2
- package/src/managers/app/app.manager.utils.ts +1 -0
- package/src/request/request.ts +1 -1
|
@@ -23,7 +23,7 @@ export declare class AppManager {
|
|
|
23
23
|
onOnline: (callback: () => void) => VoidFunction;
|
|
24
24
|
onOffline: (callback: () => void) => VoidFunction;
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
isBrowser: boolean;
|
|
27
27
|
isOnline: boolean;
|
|
28
28
|
isFocused: boolean;
|
|
29
29
|
constructor(options?: AppManagerOptionsType);
|
|
@@ -10,7 +10,7 @@ import { HttpMethodsType, NegativeTypes } from "types";
|
|
|
10
10
|
* :::
|
|
11
11
|
*
|
|
12
12
|
* @attention
|
|
13
|
-
* The most important thing about the request is that it keeps data in the format that can be dumped. This is necessary for the
|
|
13
|
+
* The most important thing about the request is that it keeps data in the format that can be dumped. This is necessary for the persistence and different dispatcher storage types.
|
|
14
14
|
* This class doesn't have any callback methods by design and communicate with dispatcher and cache by events.
|
|
15
15
|
*/
|
|
16
16
|
export declare class Request<Response, Payload, QueryParams extends QueryParamsType | string, GlobalError, // Global Error Type
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyper-fetch/core",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Cache, Queue and Persist your requests no matter if you are online or offline!",
|
|
6
6
|
"author": "Maciej Pyrc <m.pyrc@interia.pl>",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"lint": "eslint . --ext .js,.jsx,.tsx,.ts --fix",
|
|
22
22
|
"format": "prettier --write .",
|
|
23
23
|
"typecheck": "tsc --noEmit --emitDeclarationOnly false",
|
|
24
|
-
"
|
|
24
|
+
"tests": "yarn lint-staged",
|
|
25
25
|
"release": "yarn semantic-release --extends ./release.config.js -t 'hyper-fetch-v${version}'"
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
package/src/adapter/adapter.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { browserAdapter, serverAdapter, AdapterType } from "adapter";
|
|
2
2
|
|
|
3
3
|
export const adapter: AdapterType = async (request, requestId) => {
|
|
4
|
-
if (
|
|
4
|
+
if (!window?.XMLHttpRequest) {
|
|
5
5
|
return serverAdapter(request, requestId);
|
|
6
6
|
}
|
|
7
7
|
return browserAdapter(request, requestId);
|
|
@@ -15,7 +15,7 @@ export class AppManager {
|
|
|
15
15
|
emitter = new EventEmitter();
|
|
16
16
|
events = getAppManagerEvents(this.emitter);
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
isBrowser: boolean;
|
|
19
19
|
isOnline: boolean;
|
|
20
20
|
isFocused: boolean;
|
|
21
21
|
|
|
@@ -33,7 +33,7 @@ export class AppManager {
|
|
|
33
33
|
focusEvent(this.setFocused);
|
|
34
34
|
onlineEvent(this.setOnline);
|
|
35
35
|
|
|
36
|
-
this.
|
|
36
|
+
this.isBrowser = hasDocument();
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
private setInitialFocus = async (initValue: Exclude<AppManagerOptionsType["initiallyFocused"], undefined>) => {
|
package/src/request/request.ts
CHANGED
|
@@ -27,7 +27,7 @@ import { HttpMethodsEnum } from "constants/http.constants";
|
|
|
27
27
|
* :::
|
|
28
28
|
*
|
|
29
29
|
* @attention
|
|
30
|
-
* The most important thing about the request is that it keeps data in the format that can be dumped. This is necessary for the
|
|
30
|
+
* The most important thing about the request is that it keeps data in the format that can be dumped. This is necessary for the persistence and different dispatcher storage types.
|
|
31
31
|
* This class doesn't have any callback methods by design and communicate with dispatcher and cache by events.
|
|
32
32
|
*/
|
|
33
33
|
export class Request<
|