简体   繁体   中英

External Functions “not defined” warning JSHINT

I'm using AngularJS to create an app and i'm using an external library to hash strings.

<script src="bower_components/blueimp-md5/js/md5.js"></script>

In a controller i call md5() function that hash a string.

md5(myKey);

This works but Jshint gives me a warning : md5 is not defined

How to avoid that and what's the best way to call external libraries ?

Thks in advance.

Edit : I set "md5": true in my .jshintrc, I don't have the warning anymore but is that the best practice ?

Matt

You can add definition in .jshintrc file in section "globals" to avoid warnings like this:

{
  "blabla": true,
  "globals": {
    "md5": true
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM