admin管理员组

文章数量:1296305

In Visual Studio 2012, I created a web application then found the following line in the default _references.js script that came with the project:

/// <reference path="jquery-1.8.2.js" />

What is this reference notation doing? This is confusing - isn't this just a ment, which shouldn't do anything? As I understand, a double slash (//) ments out a line in JavaScript. Is there anything special about triple-slash ments?

In Visual Studio 2012, I created a web application then found the following line in the default _references.js script that came with the project:

/// <reference path="jquery-1.8.2.js" />

What is this reference notation doing? This is confusing - isn't this just a ment, which shouldn't do anything? As I understand, a double slash (//) ments out a line in JavaScript. Is there anything special about triple-slash ments?

Share Improve this question edited Jun 17, 2013 at 3:49 doppelgreener 5,12410 gold badges48 silver badges67 bronze badges asked Jun 17, 2013 at 2:53 forrestgforrestg 3475 silver badges13 bronze badges 3
  • 2 It's great that you know what you're writing about - we want to understand too, maybe if you gave a code example... – Nir Alfasi Commented Jun 17, 2013 at 2:55
  • 6 It is a special ment to assist IntelliSense and is ignored by the piler since it is just a ment. – Raymond Chen Commented Jun 17, 2013 at 3:03
  • 3 @RaymondChen Post that as an answer. :) – doppelgreener Commented Jun 17, 2013 at 3:34
Add a ment  | 

2 Answers 2

Reset to default 5

see this article

http://msdn.microsoft./en-us/library/vstudio/bb385682.aspx

and find Reference Directives

A reference directive enables Visual Studio to establish a relationship between the script you are currently editing and other scripts. The reference directive lets you include a script file in the scripting context of the current script file. This enables IntelliSense to reference externally defined functions, types, and fields as you code.

It's a Triple Slash Directive and has many uses.

See this article

https://www.typescriptlang/docs/handbook/triple-slash-directives.html

... Triple-slash references instruct the piler to include additional files in the pilation process....

Very useful in linking typings definitions... for example, the mysql.d.ts typings has the following reference to the node.js typings...

///<reference path='../node/node.d.ts' />

本文标签: What is this JavaScript reference syntax used in Visual StudioStack Overflow