How to pass a second parameter to geolocation success function ?

人盡茶涼 提交于 2019-12-11 12:57:19

问题


This is what I'd like to do:

navigator.geolocation.getCurrentPosition( wallEventByCat( variable, position ), handle_errors );

in order to have this kind of callback:

function wallEventByCat( position, category )
{
}

Is this doable ? if yes, how ?

Thanks


回答1:


You should use an anounymous function like:

navigator.geolocation.getCurrentPosition( function(position){
     wallEventByCat( variable, position );
}, handle_errors );


来源:https://stackoverflow.com/questions/22032361/how-to-pass-a-second-parameter-to-geolocation-success-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!