【发布时间】:2015-08-14 05:12:24
【问题描述】:
我正在使用一个地理编码器 API,它在回调中返回结果
data = data ? data : {} // if not given initialize to empty
geocoder.geocode('Kathmandu, Nepal' , function(err, res) {
data.lat = res[0].latitude;
data.lng = res[0].longitude;
});
并使用数据object 构建一个地理点
here = new GeoPoint(here); // data is still {} here
我的问题是如何在上述场景中使用回调响应?
【问题讨论】:
标签: node.js asynchronous callback