UNPKG

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