I can't get cloud9 to reference functions/variables in other files. For example I would set up a simple HTML5-App:
<!DOCTYPE html>
<html>
<head>
<title>testApp</title>
</head>
<body>
<div id="menuContainer"></div>
<script type="text/javascript" src="js/lib.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</body>
</html>
See, I would like to reference the objects in lib.js within main.js:
var menu=new lib.Menu('menuContainer',{'File','Edit','About'});
But the cloud9 editor warns me, that lib is an unknown variable (and of course code completion is out of question). Under VisualStudio I would try to enforce a reference with something like:
/// <reference path="js/lib.js" />
Is something similiar possible in cloud9? How to set it up?
There isn't a way for the Cloud9 linter (Cloud9 uses ESLint to lint Javascript) to know which files will be loaded before a certain file in which html file, but there is a way to let the linter know which objects are global so it will not warn you about using undefined variables.
You can do that by marking those variables as global, and you can do that by adding the following line:
/*global var1, var2 */
where var1
, and var2
are two global objects.