如何使用来自ember-cli路由的第三方javascript [英] how to use third party javascript from ember-cli route
本文介绍了如何使用来自ember-cli路由的第三方javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在路由中使用一个javascript库。
它被称为CarrotSearchFoamTree。
为了在Brocfile.js中添加它将工作
app.import('vendor / foamtree / carrotsearch.foamtree.js );
当我写我的路线时
var foamtree = new CarrotSearchFoamTree({
id:visualization,
pixelRatio:window.devicePixelRatio || 1,
initializer:treemap,
relaxVisible:false,
relaxQualityThreshold:5,
rolloutDuration:0,
pullbackDuration:0,
finalCompleteDrawMaxDuration:50,
finalIncrementalDrawMaxDuration:20
});
构建中的jshint告诉我:
routes / search.js:line 104,col 25,'CarrotSearchFoamTree'未定义。
如何避免这个错误?
谢谢,
David
解决方案
只需将它添加到 .jshintrc
配置如下:
predef:{
CarrotSearchFoamTree:true
}
你不应该看到警告了。
I work on an ember-cli project. I want to use a javascript library in the route.
It is called CarrotSearchFoamTree.
In order that it will work i added in Brocfile.js
app.import('vendor/foamtree/carrotsearch.foamtree.js');
When i write in my route
var foamtree = new CarrotSearchFoamTree({
id: "visualization",
pixelRatio: window.devicePixelRatio || 1,
initializer: "treemap",
relaxationVisible: false,
relaxationQualityThreshold: 5,
rolloutDuration: 0,
pullbackDuration: 0,
finalCompleteDrawMaxDuration: 50,
finalIncrementalDrawMaxDuration: 20
});
jshint in the build tells me:
routes/search.js: line 104, col 25, 'CarrotSearchFoamTree' is not defined.
How can i avoid this error?
Thanks,
David
解决方案
Just add it to the .jshintrc
configuration like:
"predef": {
"CarrotSearchFoamTree": true
}
And you shouldn't see the warning anymore.
这篇关于如何使用来自ember-cli路由的第三方javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文