@amedia/user 0.14.15 → 0.14.16
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/user.d.ts
CHANGED
|
@@ -364,7 +364,7 @@ declare module '@amedia/user/eventHandlers/navigation' {
|
|
|
364
364
|
export const internalLocationHref: (url: string) => void;
|
|
365
365
|
export const internalLocationReload: () => void;
|
|
366
366
|
export const internalLocationReplace: (url: string) => void;
|
|
367
|
-
export const
|
|
367
|
+
export const missingWindowContext: () => boolean;
|
|
368
368
|
export const listenForNavigationRequests: () => void;
|
|
369
369
|
|
|
370
370
|
}
|
package/package.json
CHANGED
|
@@ -75,7 +75,7 @@ beforeEach(() => {
|
|
|
75
75
|
|
|
76
76
|
describe('when window is not set', () => {
|
|
77
77
|
beforeEach(() => {
|
|
78
|
-
spyOn(navigation, '
|
|
78
|
+
spyOn(navigation, 'missingWindowContext').and.returnValue(true);
|
|
79
79
|
dispatch(
|
|
80
80
|
new CustomEvent(AmediaUserEvents.REQUEST_NAVIGATION, {
|
|
81
81
|
detail: { type: 'reload' },
|
|
@@ -95,7 +95,7 @@ describe('when window is not set', () => {
|
|
|
95
95
|
|
|
96
96
|
describe('when window exists', () => {
|
|
97
97
|
beforeEach(() => {
|
|
98
|
-
spyOn(navigation, '
|
|
98
|
+
spyOn(navigation, 'missingWindowContext').and.returnValue(false);
|
|
99
99
|
});
|
|
100
100
|
|
|
101
101
|
describe('and requesting reload', () => {
|
|
@@ -11,7 +11,7 @@ export const internalLocationReload = () => window.location.reload();
|
|
|
11
11
|
export const internalLocationReplace = (url: string) =>
|
|
12
12
|
window.location.replace(url);
|
|
13
13
|
|
|
14
|
-
export const
|
|
14
|
+
export const missingWindowContext = () => typeof window === 'undefined';
|
|
15
15
|
|
|
16
16
|
const handleNavigation = ({
|
|
17
17
|
detail: { type, url, replace },
|
|
@@ -37,7 +37,7 @@ const handleNavigation = ({
|
|
|
37
37
|
|
|
38
38
|
export const listenForNavigationRequests = () =>
|
|
39
39
|
listenWithExclusivity(AmediaUserEvents.REQUEST_NAVIGATION, (evt) => {
|
|
40
|
-
if (
|
|
40
|
+
if (missingWindowContext()) {
|
|
41
41
|
log.error(
|
|
42
42
|
'Navigation attempted context without window. Be careful not to use interactive UX code in workers and other settings.'
|
|
43
43
|
);
|