I understand how things like matching names and Module Patterns can cope with issues related to global leakage .
I also fully see the value of resource dependency management, which is provided for in the protocol require()described in the CommonJS Specification .
However, I'm stupefied in favor of using and assigning AMD features define().
CommonJS signature for definition:
define(id?, dependencies?, factory);
Additionally...
Firstly, it “seemed” to be somehow another plugin shell ... until I began to see how people use it together with the module template.
So my questions are:
- What does the protocol
define()
outlined in the CommonJS specification buy me? - Is it somehow more eloquent?
- Does this mean replacing a modular template?
- Somehow faster?
- If so, why?
source
share