* @private * @function WebMap.prototype.getMapInfo * @description 获取地图的json信息 * @param {string} url - 请求地图的url
(url)
| 296 | * @param {string} url - 请求地图的url |
| 297 | */ |
| 298 | getMapInfo(url) { |
| 299 | let that = this, |
| 300 | mapUrl = url; |
| 301 | if (url.indexOf('.json') === -1) { |
| 302 | url = this.handleJSONSuffix(url); |
| 303 | //传递过来的url,没有包括.json,在这里加上。 |
| 304 | mapUrl = url; |
| 305 | } |
| 306 | FetchRequest.get(that.getRequestUrl(mapUrl), null, { |
| 307 | withCredentials: that.isCredentail(mapUrl) |
| 308 | }) |
| 309 | .then(function (response) { |
| 310 | return response.json(); |
| 311 | }) |
| 312 | .then(function (mapInfo) { |
| 313 | that.getMapInfoSuccess(mapInfo); |
| 314 | }) |
| 315 | .catch(function (error) { |
| 316 | that.errorCallback && that.errorCallback(error, 'getMapFaild', that.map); |
| 317 | }); |
| 318 | } |
| 319 | |
| 320 | /** |
| 321 | * @private |
no test coverage detected