pagedown
pagedown copied to clipboard
Support asynchronous module definition
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:
define(['Markdown.Converter'], function(Converter) {
// return Editor here
});
And in the client code:
require(['Markdown.Converter', 'Markdown.Editor'], function(Converter, Editor) {
// ...
});
With non-CommonJs compat:
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
I was somewhat expecting this request :)
I'll look at it.
Original comment by [email protected] on 5 Aug 2011 at 5:30
- Changed state: Accepted
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
This would be great for using pagedown in GitHub's gollum software.
Original comment by [email protected] on 7 Jun 2012 at 4:32