Sort events / observables in all cases

Right now this only changes the order of events of the UrlTile class.
This commit is contained in:
Maximilian Krög
2020-02-29 23:28:51 +01:00
parent 457e7216b4
commit 1d7d7a7eef

View File

@@ -120,6 +120,19 @@ exports.astNodeVisitor = {
}
};
function sortOtherMembers(doclet) {
if (doclet.fires) {
doclet.fires.sort(function(a, b) {
return a.split(/#?event:/)[1] < b.split(/#?event:/)[1] ? -1 : 1;
});
}
if (doclet.observables) {
doclet.observables.sort(function(a, b) {
return a.name < b.name ? -1 : 1;
});
}
}
exports.handlers = {
newDoclet: function(e) {
@@ -149,16 +162,7 @@ exports.handlers = {
if (doclet.kind == 'class') {
includeAugments(doclet);
}
if (doclet.fires) {
doclet.fires.sort(function(a, b) {
return a.split(/#?event:/)[1] < b.split(/#?event:/)[1] ? -1 : 1;
});
}
if (doclet.observables) {
doclet.observables.sort(function(a, b) {
return a.name < b.name ? -1 : 1;
});
}
sortOtherMembers(doclet);
// Always document namespaces and items with stability annotation
continue;
}
@@ -175,6 +179,7 @@ exports.handlers = {
// constructor from the docs.
doclet._hideConstructor = true;
includeAugments(doclet);
sortOtherMembers(doclet);
} else if (!doclet._hideConstructor && !(doclet.kind == 'typedef' && doclet.longname in types)) {
// Remove all other undocumented symbols
doclet.undocumented = true;