问题描述
如何在不使用javascript棉绒的情况下给出括号的情况下使用库?例如,我正在使用chart.js,并且该产品运行正常,但括号给出了一个错误,该错误是在定义Chart之前使用的.有什么办法可以隐藏此错误?我发现它对其他事情很有帮助,但是由于一个错误而总是弹出它很烦人.这也可能是我的错误,也许即使它是库的一部分,我也必须定义该变量?
How do you use libraries in Brackets without the javascript lint giving errors? For example I am using chart.js and the product works completely fine but Brackets gives an error that Chart was used before being defined. Is there any way to hide this error? I find it helpful for other things but having it always pop up because of one error is annoying. This could be an error on my part as well, maybe I must define the variable even though it is part of the library?
推荐答案
您需要在js文件顶部提供jslint选项,例如:
You need to supply jslint options at the top of the js file, for example:
/*global window, jQuery, require, charts */
也许还有一种在全球范围内进行此操作的方法,我只是还没有对其进行研究(真的没有必要)
There might also be a way to do this globally, i just haven't researched it yet (don't really see a need for it)
这篇关于在Adobe Brackets IDE中使用JavaScript库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!