简体   繁体   English

检查 function 是否存在于其他 javascript 模块中

[英]Check if function exists in other javascript module

I have a web page that loads two javascript modules: <script type="module> . I want, in one module to check if a function exists in the other. I can see no way to do this. The firefox debugger identifies the functions in the module where I'm checking, but I can find no way to examine the functions in the other. Is there some way to do this? I have a web page that loads two javascript modules: <script type="module> . I want, in one module to check if a function exists in the other. I can see no way to do this. The firefox debugger identifies the functions在我正在检查的模块中,但我无法检查另一个模块中的功能。有没有办法做到这一点?

Each module has its own top-level scope .每个模块都有自己的顶级 scope In other words, top-level variables and functions from a module are not seen in other scripts.换句话说,模块中的顶级变量和函数在其他脚本中是看不到的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM