@shopify/app-bridge
Version:
> **Maintenance Mode:** Although apps using this package will continue to function, it is no longer receiving updates. For new projects, please use the [CDN version of App Bridge](https://shopify.dev/docs/api/app-home?accordionItem=getting-started-build-y
27 lines (26 loc) • 719 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getWindow = exports.getLocation = exports.redirect = exports.shouldRedirect = void 0;
function shouldRedirect(frame) {
return frame === window;
}
exports.shouldRedirect = shouldRedirect;
function redirect(url) {
var location = getLocation();
if (!location) {
return;
}
location.assign(url);
}
exports.redirect = redirect;
function getLocation() {
return hasWindow() ? window.location : undefined;
}
exports.getLocation = getLocation;
function getWindow() {
return hasWindow() ? window : undefined;
}
exports.getWindow = getWindow;
function hasWindow() {
return typeof window !== 'undefined';
}