@qlibs/utils 1.11.0 → 1.11.1

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.
@@ -1,2 +1,2 @@
1
1
  export declare function getBasePath(): string;
2
- export declare function goBack(navigateFunction: Function): void;
2
+ export declare function goBack(navigateFunction?: Function): void;
@@ -11,11 +11,16 @@ function getBasePath() {
11
11
  return '/' + baseSegments.join('/');
12
12
  }
13
13
  function goBack(navigateFunction) {
14
- if (window.history.length > 0) {
14
+ if ((window.history || []).length > 0 && navigateFunction) {
15
15
  navigateFunction(-1);
16
16
  }
17
17
  else {
18
18
  const backPath = getBasePath();
19
- navigateFunction(backPath);
19
+ if (navigateFunction) {
20
+ navigateFunction(backPath);
21
+ }
22
+ else {
23
+ window.location.href = backPath;
24
+ }
20
25
  }
21
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qlibs/utils",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "",
5
5
  "author": "QBIT Developer",
6
6
  "license": "MIT",