在其他文件中获得JS的VS javascript intellisense

编程入门 行业动态 更新时间:2024-10-25 22:34:07
本文介绍了在其他文件中获得JS的VS javascript intellisense的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

因此,我在javascript文件顶部定义了枚举",如下所示:

var loaderOptions = { "SHOW": 0, "CHANGEPAGE": 1, "HIDE": 2 };

我希望此枚举可在以后使用的实用程序函数中使用(showLoader(milliseconds,elementOrPageID,option,textMessage,callbackFunc){}).

当我调用枚举/变量

但是,我想将功能及其枚举从我的主文件中移出到实用程序文件中……我可以使这项工作正常,但我却失去了智能感知能力……可以保持这种状态的任何技巧能力?

解决方案

在JavaScript文件顶部添加引用指令

/// <reference path="file1.js" />

MSDN文档

So I've defined my 'enum' at the top of my javascript file as so:

var loaderOptions = { "SHOW": 0, "CHANGEPAGE": 1, "HIDE": 2 };

I wanted this enum to be used in a utility function used later ( showLoader(miliseconds, elementOrPageID, option, textMessage, callbackFunc) {} ).

This is all working fabulously as I have intellisense when I call the enum/variable

HOWEVER, I would like to move the function and its enum OUT of my main file into a utility file ... I can make this work just fine but I lose the intellisense ... any tricks to be able to keep this ability?

解决方案

Add a References Directive on top of the JavaScript file

/// <reference path="file1.js" />

MSDN Doc

更多推荐

在其他文件中获得JS的VS javascript intellisense

本文发布于:2023-11-17 14:01:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1610136.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   JS   intellisense   javascript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!