0

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?

1 Answer 1

1

Each module has its own top-level scope. In other words, top-level variables and functions from a module are not seen in other scripts.

Sign up to request clarification or add additional context in comments.

1 Comment

Damn! I had suspected that this was the case for quite a while, but this is the first time I've seen an article about it. I wonder if this will ever be addressed by the W3C or whoever is responsible. Thank you, Dr. Nugent, for your, quick, complete and very useful reply.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.