-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Original issue: canjs/canjs/issues/2706
Dependent on: canjs/bit-docs-html-canjs/issues/189
The prettyPrint
method takes a couple of parameters, the first of which is a function to be executed when the prettifying is complete. (See here).
Where we call the prettyPrint method, we could provide a return value of a Deferred which is resolved within prettyPrint's done callback.
Something like:
require('./prettify-engine');
require('./prettify.less');
var $ = require('jquery');
module.exports = function () {
var doneDeferred = $.Deferred();
var codes = document.getElementsByTagName('code');
for (var i = 0; i < codes.length; i++) {
var code = codes[i];
if (code.parentNode.nodeName.toUpperCase() === 'PRE') {
code.className = code.className + ' prettyprint';
}
}
prettyPrint(function(){
doneDeferred.resolve();
});
return doneDeferred;
};
Metadata
Metadata
Assignees
Labels
No labels