mobilemode.api.lbs4amap_wev8.js 1.03 KB
define("mApi/lbs4amap",["mUtil","amap"],function(n){var s=[];return{getCurrPosition:function(e,t){function o(i,c){AMap.plugin("AMap.Geocoder",function(){(new AMap.Geocoder).getAddress([i,c],function(e,t){var o,n;t=t.regeocode||{},o=t.formattedAddress,n=t.addressComponent||{},s.forEach(function(e){e&&e({status:"1",errMsg:"",lng:i,lat:c,addr:o,province:n.province,city:n.city,district:n.district,street:n.street,streetNumber:n.streetNumber})}),s=[]})})}s.push(e),n.checkEmpJsApi("getLocation")?n.invokeEmApi("getLocation",{type:"wgs84",success:function(e){o(e.longitude,e.latitude)}}):n.runtime.isEmobile()?(window.getLBSResult=function(e){var t=e.split(",");o(t[2],t[1])},location="emobile:gps:getLBSResult"):"undefined"!=typeof eb_GetLocation&&n.isFunction(eb_GetLocation)?(window.getLBSResult=function(e,t){o(e,t)},eb_GetLocation("getLBSResult")):AMap.plugin("AMap.Geolocation",function(){new AMap.Geolocation({enableHighAccuracy:!0}).getCurrentPosition(function(e,t){"complete"===e?o(t.position.P,t.position.O):n.console.error(t.message)})})}}});