UNPKG

719 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.getWindow = exports.getLocation = exports.redirect = exports.shouldRedirect = void 0;
4function shouldRedirect(frame) {
5 return frame === window;
6}
7exports.shouldRedirect = shouldRedirect;
8function redirect(url) {
9 var location = getLocation();
10 if (!location) {
11 return;
12 }
13 location.assign(url);
14}
15exports.redirect = redirect;
16function getLocation() {
17 return hasWindow() ? window.location : undefined;
18}
19exports.getLocation = getLocation;
20function getWindow() {
21 return hasWindow() ? window : undefined;
22}
23exports.getWindow = getWindow;
24function hasWindow() {
25 return typeof window !== 'undefined';
26}