MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / isSupportWebp

Method isSupportWebp

src/openlayers/mapping/WebMap.js:5348–5376  ·  view source on GitHub ↗

* @private * @function WebMap.prototype.isSupportWebp * @description 判断是否支持webP * @param {*} url 服务地址 * @param {*} token 服务token * @param {*} proxy * @returns {boolean}

(url, token, proxy)

Source from the content-addressed store, hash-verified

5346 * @returns {boolean}
5347 */
5348 isSupportWebp(url, token, proxy) {
5349 // 还需要判断浏览器
5350 let isIE = this.isIE();
5351 if (
5352 isIE ||
5353 (this.isFirefox() && this.getFirefoxVersion() < 65) ||
5354 (this.isChrome() && this.getChromeVersion() < 32)
5355 ) {
5356 return false;
5357 }
5358 url = token ? `${url}/tileImage.webp?token=${token}` : `${url}/tileImage.webp`;
5359 url = this.getRequestUrl(url, proxy);
5360 return FetchRequest.get(url, null, {
5361 withCredentials: this.isCredentail(url, proxy),
5362 withoutFormatSuffix: true
5363 })
5364 .then(function (response) {
5365 if (response.status !== 200) {
5366 throw response.status;
5367 }
5368 return response;
5369 })
5370 .then(() => {
5371 return true;
5372 })
5373 .catch(() => {
5374 return false;
5375 });
5376 }
5377 /**
5378 * @private
5379 * @function WebMap.prototype.isIE

Callers 3

WebMap2Spec.jsFile · 0.80
getTileInfoMethod · 0.80

Calls 8

isIEMethod · 0.95
isFirefoxMethod · 0.95
getFirefoxVersionMethod · 0.95
isChromeMethod · 0.95
getChromeVersionMethod · 0.95
getRequestUrlMethod · 0.95
isCredentailMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected