2017-12-05 20:34:24 +00:00
|
|
|
// @flow
|
2017-09-07 04:20:04 +00:00
|
|
|
|
|
|
|
declare var JitsiMeetJS: Object;
|
2017-09-01 19:14:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Loads a script from a specific URL. The script will be interpreted upon load.
|
|
|
|
*
|
|
|
|
* @param {string} url - The url to be loaded.
|
|
|
|
* @returns {Promise} Resolved with no arguments when the script is loaded and
|
|
|
|
* rejected with the error from JitsiMeetJS.ScriptUtil.loadScript method.
|
|
|
|
*/
|
2017-12-01 21:07:58 +00:00
|
|
|
export function loadScript(url: string): Promise<void> {
|
2017-09-01 19:14:03 +00:00
|
|
|
return new Promise((resolve, reject) =>
|
|
|
|
JitsiMeetJS.util.ScriptUtil.loadScript(
|
|
|
|
url,
|
|
|
|
/* async */ true,
|
|
|
|
/* prepend */ false,
|
|
|
|
/* relativeURL */ false,
|
2017-09-07 04:20:04 +00:00
|
|
|
/* loadCallback */ resolve,
|
|
|
|
/* errorCallback */ reject));
|
2017-09-01 19:14:03 +00:00
|
|
|
}
|