How can I check if function exists on window.external

杀马特。学长 韩版系。学妹 提交于 2019-12-24 00:49:34

问题


How can I check if function exists on window.external?

I'm calling C# code from javascript and I want to check if a method exists in the C# object.


回答1:


I found the way, Just using the 'in' operator like this:

if ('FunctionName' in window.external){
    window.external.FunctionName(...);
}


来源:https://stackoverflow.com/questions/42226772/how-can-i-check-if-function-exists-on-window-external

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