how to use third party javascript from ember-cli route

二次信任 提交于 2019-12-12 04:50:02

问题


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


回答1:


Just add it to the .jshintrc configuration like:

"predef": {
  "CarrotSearchFoamTree": true
}

And you shouldn't see the warning anymore.



来源:https://stackoverflow.com/questions/24775760/how-to-use-third-party-javascript-from-ember-cli-route

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!