@24i/bigscreen-sdk 1.0.11 → 1.0.12-alpha.2237
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/package.json
CHANGED
|
@@ -2,8 +2,10 @@ import { NavigationConfig } from './types';
|
|
|
2
2
|
|
|
3
3
|
export const history: string[] = [];
|
|
4
4
|
|
|
5
|
+
const pathWithHash = (path:string) => `#${path}`;
|
|
6
|
+
|
|
5
7
|
const navigate = (path: string) => {
|
|
6
|
-
window.location.href =
|
|
8
|
+
window.location.href = pathWithHash(path);
|
|
7
9
|
};
|
|
8
10
|
|
|
9
11
|
export const go = (path: string, { skipHistory, replaceHistory }: NavigationConfig = {}) => {
|
|
@@ -22,3 +24,8 @@ export const back = () => {
|
|
|
22
24
|
export const clearHistory = () => {
|
|
23
25
|
history.length = 0;
|
|
24
26
|
};
|
|
27
|
+
|
|
28
|
+
export const replaceState = (path: string) => {
|
|
29
|
+
history[history.length - 1] = path;
|
|
30
|
+
window.history.replaceState(null, '', pathWithHash(path));
|
|
31
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Router } from './Router';
|
|
2
2
|
export { Route } from './Route';
|
|
3
3
|
export type { IRoute } from './types';
|
|
4
|
-
export { history, go, back, clearHistory } from './history';
|
|
4
|
+
export { history, go, back, clearHistory, replaceState } from './history';
|
|
5
5
|
export { focusActiveRoute } from './focusActiveRoute';
|
|
6
6
|
export { fromSafeUrl, toSafeUrl } from './utils';
|