David Michael Gang
David Michael Gang

Reputation: 7299

how to use third party javascript from ember-cli route

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

Upvotes: 0

Views: 953

Answers (1)

Altrim
Altrim

Reputation: 6756

Just add it to the .jshintrc configuration like:

"predef": {
  "CarrotSearchFoamTree": true
}

And you shouldn't see the warning anymore.

Upvotes: 2

Related Questions