From 1d7d7a7eefc73f0f6f9c495aec2b6c048cca8993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6g?= Date: Sat, 29 Feb 2020 23:28:51 +0100 Subject: [PATCH] Sort events / observables in all cases Right now this only changes the order of events of the UrlTile class. --- config/jsdoc/api/plugins/api.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/config/jsdoc/api/plugins/api.js b/config/jsdoc/api/plugins/api.js index edeaf1b3b9..0c4d80e85e 100644 --- a/config/jsdoc/api/plugins/api.js +++ b/config/jsdoc/api/plugins/api.js @@ -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;