mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Merge pull request #421 from ErnstHaagsman/processingcomplete-event
Plugins: Created processingComplete event
This commit is contained in:
commit
0f79895be2
2
jsdoc.js
2
jsdoc.js
@ -237,6 +237,8 @@ function main() {
|
||||
jsdoc.augment.addInherited(docs);
|
||||
jsdoc.borrow.resolveBorrows(docs);
|
||||
|
||||
app.jsdoc.parser.fireProcessingComplete({doclets: docs});
|
||||
|
||||
if (env.opts.explain) {
|
||||
dump(docs);
|
||||
process.exit(0);
|
||||
|
||||
@ -97,6 +97,10 @@ exports.Parser.prototype.parse = function(sourceFiles, encoding) {
|
||||
return this._resultBuffer;
|
||||
};
|
||||
|
||||
exports.Parser.prototype.fireProcessingComplete = function(doclets) {
|
||||
this.emit('processingComplete', doclets);
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {Array<Doclet>} The accumulated results of any calls to parse.
|
||||
*/
|
||||
|
||||
@ -19,7 +19,8 @@ var events = conf.include || [
|
||||
'symbolFound',
|
||||
'newDoclet',
|
||||
'fileComplete',
|
||||
'parseComplete'
|
||||
'parseComplete',
|
||||
'processingComplete'
|
||||
];
|
||||
// Don't dump the excluded parser events
|
||||
if (conf.exclude) {
|
||||
|
||||
@ -77,6 +77,14 @@ describe("jsdoc/src/parser", function() {
|
||||
expect(spy).toHaveBeenCalled();
|
||||
expect(spy.mostRecentCall.args[0].sourcefiles).toEqual(["[[string0]]"]);
|
||||
});
|
||||
|
||||
it("should fire processingComplete when fireProcessingComplete is called", function() {
|
||||
var spy = jasmine.createSpy(),
|
||||
doclets = {doclets: ['a','b']};
|
||||
parser.on('processingComplete', spy).fireProcessingComplete(doclets);
|
||||
expect(spy).toHaveBeenCalled();
|
||||
expect(spy.mostRecentCall.args[0]).toEqual(doclets);
|
||||
});
|
||||
|
||||
it("should be able to parse its own source file", function() {
|
||||
var fs = require('jsdoc/fs'),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user