Passing an argument into a function as a parameter of a function call

落花浮王杯 提交于 2019-12-08 11:24:08

问题


This is probably more of a JavaScript question but I'd like to pass another parameter in the getPicture_Success function argument here:

navigator.camera.getPicture(getPicture_Success, null, options);

The getPicture_Success function's signature is getPicture_Success(imageData).

I'm trying to do 2 different things depending on where in the app the photo is needed - rendering the image on a different screen for each.

I'd like to pass another argument into it, like getPicture_Success(imageData, appScreen), for example.


回答1:


navigator.camera.getPicture(function(imageData) {
    getPicture_Success(imageData, 'Screen 1');
}, null, options);


来源:https://stackoverflow.com/questions/4429328/passing-an-argument-into-a-function-as-a-parameter-of-a-function-call

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