Support asynchronous module definition
- Vorherrschende Sprache
- JavaScript
- Sterne
- 0
- Forks
- 0
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
``````
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
```
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
The issue proposes adding asynchronous module definition (AMD) support to Pagedown, a Markdown converter library. Start by examining the existing module structure in the source files to understand how Markdown.Converter and Markdown.Editor are currently defined. Research AMD patterns like define() and require() from requirejs, then modify the library to optionally export via AMD while maintaining backward compatibility. Test by creating a sample page that loads the modules asynchronously with requirejs.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- frontend
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100