简体   繁体   中英

JavaScript namespace references in IntelliSense

I'm learning how to put all my JS inside a namespace and how add other things to the same namespace. I'm using VS 2013 with a MVC page.

Here I create skillet in first namespace.js with some properties, then in namespace2.js add another property.

As you can see in HTML after adding both JS I can see all properties. But inside namespace2.js cant see properties from namespace.js

在此处输入图片说明

My idea is have a main JS for all my projects, and use the second one to fine details depending on specifics requirements.

Is there a way second JS know what is define in first JS?

Something like:

#include "namespace.js" 
using namespace.js;
<script>namespace.js</script>

you could use /// <reference ...> directive as you can see in msdn docs

Other useful answers in SO:

Best Practices for IntelliSense JavaScript references

Enabling javascript intellisense for external libraries in Visual Studio

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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