Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 39246x 39246x 39246x 1x 39247x 1x 39246x 39245x 39245x 39246x 39246x 27009x 12237x | import Uri from "urijs";
import defined from "./defined.js";
import DeveloperError from "./DeveloperError.js";
/**
* Given a relative Uri and a base Uri, returns the absolute Uri of the relative Uri.
* @function
*
* @param {string} relative The relative Uri.
* @param {string} [base] The base Uri.
* @returns {string} The absolute Uri of the given relative Uri.
*
* @example
* //absolute Uri will be "https://test.com/awesome.png";
* const absoluteUri = Cesium.getAbsoluteUri('awesome.png', 'https://test.com');
*/
function getAbsoluteUri(relative, base) {
let documentObject;
Eif (typeof document !== "undefined") {
documentObject = document;
}
return getAbsoluteUri._implementation(relative, base, documentObject);
}
getAbsoluteUri._implementation = function (relative, base, documentObject) {
//>>includeStart('debug', pragmas.debug);
if (!defined(relative)) {
throw new DeveloperError("relative uri is required.");
}
//>>includeEnd('debug');
if (!defined(base)) {
Iif (typeof documentObject === "undefined") {
return relative;
}
base = documentObject.baseURI ?? documentObject.location.href;
}
const relativeUri = new Uri(relative);
if (relativeUri.scheme() !== "") {
return relativeUri.toString();
}
return relativeUri.absoluteTo(base).toString();
};
export default getAbsoluteUri;
|