Domanda

When I look at the source code of the dojo 1.7 amd dependency list, i see the following:

define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/lang", "./selector/_loader", "./selector/_loader!default"],

The only use of an exclamation mark I know is for plugins, I haven't seen this "!default" before.
I read this page "https://github.com/amdjs/amdjs-api/wiki/AMD" and googled about it, but I did not find any answer.
Can anybody help me with that!
Thanks
Wolfgang

Update:
Thank you, Ates Goral, for your answer.
Now everything is clear to me.
Then, the irritating thing for me with this special case was, that "./selector/_loader" occurs twice in the above line, one time without parameters and the next time with a parameter. I saw people writing "dojo/domReady!", so I thought it was mandatory to write an exclamation mark for a plugin, even without parameters. Now I have learned that plugins don't need an "!" and I will write "dojo/domReady".

Another Update:
Today I found the following interesting statement (main.js of https://github.com/csnover/dojo-boilerplate):

The “!” after the module name indicates you want to use special plugin functionality; if you were to require just “dojo/domReady”, it would load that module just like any other module, without any of the special plugin functionality.

I don't know if this statement is correct. It it is correct, then "./selector/_loader" would have some kind of hybrid functionality?

È stato utile?

Soluzione

http://livedocs.dojotoolkit.org/loader/amd

When a module identifier passed to require or define contains an "!", the loader splits the string in two at the exclamation point. The string to the left of "!" is treated like a normal module ID and is used as the identifier for the desired plugin; the string to the right of "!" is passed to the plugin for processing.

In your case, "default" is being passed to the plugin.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top