How to pass parameters to getCurrentPosition success call back?

后端 未结 2 1196
天涯浪人
天涯浪人 2021-02-20 15:01

How can I pass in one or more parameters to a success call back when calling navigator.geolocation.getcurrentPosition?

How can I pass deviceready

2条回答
  •  深忆病人
    2021-02-20 15:46

    I found this method a lot easier to understand.

    navigator.geolocation.getCurrentPosition(function (position) {
        updatePosition(position, var1, var2);
    }, errorPosition, optionsPosition);
    
    function updatePosition(position, var1, var2) {
        var coordinates = position.coords;
    }
    
    function errorPosition(error) {
        if (err.PERMISSION_DENIED === error.code) {
    
        }
    }
    
    var optionsPosition = {
        enableHighAccuracy: true,
        timeout: 10000,
        maximumAge: 0
    };
    

提交回复
热议问题