javascript - What does exclamation mark mean inside Intern's define? - Stack Overflow

When looking at the Intern.io examples, I'm not following the path syntax.For example:define([

When looking at the Intern.io examples, I'm not following the path syntax.

For example:

define([
    'intern!object',
    'intern/chai!assert',

What's going on with the '!' character?

// Non-functional test suite(s) to run in each browser
suites: [ 'intern/node_modules/dojo/has!host-browser?tests/utils' ],

Can someone explain the path reference above for the suite path?

Thanks.

When looking at the Intern.io examples, I'm not following the path syntax.

For example:

define([
    'intern!object',
    'intern/chai!assert',

What's going on with the '!' character?

// Non-functional test suite(s) to run in each browser
suites: [ 'intern/node_modules/dojo/has!host-browser?tests/utils' ],

Can someone explain the path reference above for the suite path?

Thanks.

Share Improve this question edited Nov 11, 2014 at 21:47 Pavlo 45k14 gold badges83 silver badges114 bronze badges asked Nov 11, 2014 at 21:27 bkuhlbkuhl 591 silver badge7 bronze badges 2
  • 1 The exclamation marks are specifying particular modules to load. – steve_gallagher Commented Nov 11, 2014 at 21:45
  • @steve_gallagher that's the answer, post it – Evan Davis Commented Nov 11, 2014 at 21:50
Add a ment  | 

2 Answers 2

Reset to default 8

Module IDs with exclamation points are AMD loader plugins. The part before the exclamation point is the module ID of the loader plugin module, and the part after the exclamation point is plugin-specific information that the plugin module uses to decide what to do.

  • intern!object loads the intern plugin module and then tells it "object" (which causes the plugin to load the object interface API)
  • intern/chai!assert loads the intern/chai plugin module (and tells it to load the assert-style API)
  • intern/dojo/has!host-browser?tests/utils (there should not be a node_modules in this mid) loads the dojo/has module from Intern’s internal copy of Dojo, and uses it to load tests/utils if the host-browser feature detection test is true (otherwise it loads nothing).

The exclamation marks are specifying particular modules to load.

The path reference allows an alternative AMD loader to be used.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744966143a4603691.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信