Support asynchronous module definition
- Lenguaje dominante
- JavaScript
- Estrellas
- 0
- Forks
- 0
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
``````
Supporting asynchronous module definition [1] would allow to use
CommonJS-compliant asynchronous javascript loaders like requirejs [2] on the
client side.
This also allows to declare dependencies between modules, and to ensure that
some module is loaded before an other.
This would look like this for Markdown.Converter:
``` Javascript
define(function() {
// return Converter here
});
``````
And for Markdown.Editor:
``` Javascript
define(['Markdown.Converter'], function(Converter) {
// return Editor here
});
```
And in the client code:
``` Javascript
require(['Markdown.Converter', 'Markdown.Editor'], function(Converter, Editor) {
// ...
});
```
With non-CommonJs compat:
``` Javascript
var Markdown;
function doExport(factory) {
if (typeof 'define' === 'function' && typeof 'require' === 'function') {
define.call(this, factory);
} else {
Markdown.Converter = factory();
}
}
doExport(function() {
// ... return Converter
});
```
[1] http://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition
[2] http://requirejs.org/
```
Original issue reported on code.google.com by `arnaud.lb` on 4 Aug 2011 at 5:09
```
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.