export default function MapLoader() {

	return new Promise((resolve, reject) => {
		 
		if (window.AMap) {
			resolve(window.AMap)
		} else {
//			console.log("map")
			var script = document.createElement('script')
			script.type = 'text/javascript'
			script.async = true
			script.src = 'https://webapi.amap.com/maps?v=1.4.15&callback=initAMap&key=de735ff06aec63f6bc109c9fb805fc3d'
			script.onerror = reject
			document.head.appendChild(script)
		}
		window.initAMap = () => {
			resolve(window.AMap)
		}
	})
}
