mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-15 18:17:46 +00:00
We need to make sure that on the page reload all original parameters used to load the conference are preserved. New modules helps to manage different types of conference URLs like the one used for invites and the one for reloading the page.
43 lines
929 B
JavaScript
43 lines
929 B
JavaScript
/**
|
|
* Create deferred object.
|
|
* @returns {{promise, resolve, reject}}
|
|
*/
|
|
export function createDeferred () {
|
|
let deferred = {};
|
|
|
|
deferred.promise = new Promise(function (resolve, reject) {
|
|
deferred.resolve = resolve;
|
|
deferred.reject = reject;
|
|
});
|
|
|
|
return deferred;
|
|
}
|
|
|
|
/**
|
|
* Reload page.
|
|
*/
|
|
export function reload () {
|
|
window.location.reload();
|
|
}
|
|
|
|
/**
|
|
* Redirects to new URL.
|
|
* @param {string} url the URL pointing to the location where the user should
|
|
* be redirected to.
|
|
*/
|
|
export function redirect (url) {
|
|
window.location.replace(url);
|
|
}
|
|
|
|
/**
|
|
* Prints the error and reports it to the global error handler.
|
|
* @param e {Error} the error
|
|
* @param msg {string} [optional] the message printed in addition to the error
|
|
*/
|
|
export function reportError (e, msg = "") {
|
|
console.error(msg, e);
|
|
if(window.onerror)
|
|
window.onerror(msg, null, null,
|
|
null, e);
|
|
}
|