* @private * @function WebMap.prototype.isSupportWebp * @description 判断是否支持webP * @param {*} url 服务地址 * @param {*} token 服务token * @param {*} proxy * @returns {boolean}
(url, token, proxy)
| 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 |
no test coverage detected