Answer the question
In order to leave comments, you need to log in
How to use async in JavaScript?
Good day to all! There is this code:
// получаем дистанцию
function getDistance(c, center,geoObject){
layout.showLoading();
var a = [];
routeFromCenter(c,function(g,l){
a.push(l[0]);
var q = findNereast(jGq, c, 1),
n = [],
n = 3500 > getPointDistance(q[0],c) ? findNereast(jGq,c,7) : findNereast(bjGq,c,5);
n.forEach(function(c){
c[0] == l[0][0] && c[1] == l[0][1] || a.push(c)
});
async.map(a, function(a,c){
getRoute(a,c,g)
}, function(a,c){
var l = g.map(function(a){
return a.get.getLength();
}),
l = indexOfSmallest(l);
});
}, center,geoObject);
}
<script type="text/javascript" src="https://api-maps.yandex.ru/2.1/?lang=ru_RU"></script>
<script type="text/javascript" src="map.js"></script>
Uncaught ReferenceError: async is not defined
at map.js:136
at map.js:102
at map.js:108
at ?lang=ru_RU:2
at s (?lang=ru_RU:2)
at Array.<anonymous> (?lang=ru_RU:2)
at n (?lang=ru_RU:2)
at a (?lang=ru_RU:2)
Answer the question
In order to leave comments, you need to log in
A similar code from the site mkad.mapcraft.ru works without errors. Third party libraries are not included.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question