Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is this JavaScript reference syntax used in Visual Studio?

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 comment, which shouldn't do anything? As I understand, a double slash (//) comments out a line in JavaScript. Is there anything special about triple-slash comments?

like image 706
forrestg Avatar asked Jun 17 '13 02:06

forrestg


People also ask

What is js reference?

In JavaScript, unlike in most other popular programming languages, the references are pointers to values stored in variables and NOT pointers to other variables, or references. var firestorm = [3,6,3]; var atom = firestorm; //assign-by-reference console.

Is there JavaScript in Visual Studio?

Visual Studio Code includes built-in JavaScript IntelliSense, debugging, formatting, code navigation, refactorings, and many other advanced language features. Most of these features just work out of the box, while some may require basic configuration to get the best experience.

What is Visual JavaScript?

The JavaScript framework for visual programming. Rete is a modular framework for visual programming. Rete allows you to create node-based editor directly in the browser. You can define nodes and workers that allow users to create instructions for processing data in your editor without a single line of code.


2 Answers

see this article

http://msdn.microsoft.com/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.

like image 183
sangram parmar Avatar answered Oct 19 '22 04:10

sangram parmar


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

See this article

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

... Triple-slash references instruct the compiler to include additional files in the compilation 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' />
like image 31
Dave Avatar answered Oct 19 '22 04:10

Dave