Created
March 4, 2016 17:18
-
-
Save rahul201992/935fc065cf1257df1167 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var distance2 = DISTANCE1.dashboarddistance( 18.5289, 73.8743, 18.558, 73.886,DISTANCE1.callbackFunction); | |
var finaldistnce= DISTANCE1.dashboarddistance(18.5289, 73.8743, 18.558, 73.886, function(err, distance) { | |
return distance | |
}); | |
console.log(finaldistnce);// return null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
dashboarddistance: function(a, b, c, d, callback) { | |
var ds = 0; | |
var distance = require('google-distance'); | |
distance.get({ | |
index: 1, | |
origin: a + ',' + b, | |
destination: c + ',' + d | |
}, function(err, data) { | |
if (err) { | |
console.log("a"); | |
ds = 0; | |
return callback(err, ds); | |
} else { | |
console.log("b"); | |
ds = data.distance; | |
return callback(null, ds); | |
} | |
}); | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment