I wanted to call this function inside my anonymous function, how can I do this?

1
retonaEndereco(myLatlng,adress => {

    let  getDistance = function (origin,destination) {
         let distance = geolib.getDistance(origin,destination);
         return geolib.convertUnit('km',distance);
      }


     var getAllDistances = function ()
     {
      // var dados = dadosEndereco;

      let distanciaCalc =  getDistance(
                    {latitude:-23.624467,
                    longitude:-46.731728},

                    {latitude:adress.geometry.location.lat(),
                    longitude:adress.geometry.location.lng()}
          )


           return  parseFloat(distanciaCalc).toFixed(2);
     }
     var km = getAllDistances;

     var dadosEndereco = {
             "Rua/Avenida": adress.address_components[0].long_name,
             "Bairro" : adress.address_components[1].long_name,
             "Cidade" : adress.address_components[3].long_name,
             "UF" : adress.address_components[4].short_name,
             "km" : km

     };
    this.returnDados(dadosEndereco);
    });
});

}

private returnDados (dados){
    this.nav.push(NovoPedidoPage,dados)
}
    
asked by anonymous 22.02.2017 / 19:57

0 answers