@remotion/studio
Version:
APIs for interacting with the Remotion Studio
34 lines (33 loc) • 971 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRoute = exports.reloadUrl = exports.clearUrl = exports.pushUrl = void 0;
const getUrlHandlingType = () => {
if (window.remotion_isReadOnlyStudio) {
return 'query-string';
}
return 'spa';
};
const pushUrl = (url) => {
if (getUrlHandlingType() === 'query-string') {
window.history.pushState({}, 'Studio', `${window.location.pathname}?${url}`);
}
else {
window.history.pushState({}, 'Studio', url);
}
};
exports.pushUrl = pushUrl;
const clearUrl = () => {
window.location.href = window.location.pathname;
};
exports.clearUrl = clearUrl;
const reloadUrl = () => {
window.location.reload();
};
exports.reloadUrl = reloadUrl;
const getRoute = () => {
if (getUrlHandlingType() === 'query-string') {
return window.location.search.substring(1);
}
return window.location.pathname;
};
exports.getRoute = getRoute;