6174 / 6174/pagedown

Support asynchronous module definition

Aperta
#2 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
auto-migrated Priority-Medium Type-Enhancement
Lingua principale
JavaScript
Stelle
0
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

``````
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
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
frontend
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.