问题
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