@@ -182,7 +182,7 @@ function create_functions_md(title, annotations) {
182182function create_classes_md ( title , classes ) {
183183 var result = "# " + title ;
184184 return classes . reduce ( ( agg , classAnnotation ) => {
185- let { name, description, namespace, constants, properties, functions, returns, params } = classAnnotation ;
185+ let { name, description, namespace, constants, properties, functions, returns, params, callbackproperties } = classAnnotation ;
186186 let key = [ ...namespace , name ] . join ( "." ) ;
187187 agg += '\r\n## <a name="' + key + '" id="' + key + '">' + name + '</a>' ;
188188 agg += "\r\n" + description ;
@@ -205,14 +205,44 @@ function create_classes_md(title, classes) {
205205 agg += "\r\n" ;
206206 }
207207 if ( properties . length > 0 ) {
208- agg += "\r\n### Properties" ;
209- agg += "\r\n| Name | Type | Default | Description | " ;
210- agg += "\r\n| --- | --- | --- | --- | " ;
211- properties . filter ( item => item . ignore == undefined ) . forEach ( ( { name, value, type, description } ) => {
212- type = replaceAll ( type , "|" , ", " ) ;
213- agg += "\r\n | `" + name + "` | " + type + " | `" + value + "` | " + ( description || spaceCamelCaseName ( name ) ) + " | " ;
208+ let groups = properties . reduce ( ( agg , annotation ) => {
209+ let { group } = annotation ;
210+ agg [ group ] = agg [ group ] || [ ] ;
211+ agg [ group ] . push ( annotation ) ;
212+ return agg ;
213+ } , { } ) ;
214+
215+ Object . keys ( groups ) . sort ( function ( a , b ) {
216+ if ( a == "undefined" ) {
217+ a = "0" ;
218+ }
219+ if ( b == "undefined" ) {
220+ b = "0" ;
221+ }
222+ if ( a < b ) { return - 1 ; }
223+ if ( a > b ) { return 1 ; }
224+ return 0 ;
225+ } ) . forEach ( ( group ) => {
226+ if ( group == "undefined" ) {
227+ agg += "\r\n### Properties" ;
228+ } else {
229+ agg += "\r\n### " + group + " Properties" ;
230+ }
231+ agg += "\r\n| Name | Type | Default | Description | " ;
232+ agg += "\r\n| --- | --- | --- | --- | " ;
233+ groups [ group ] . filter ( item => item . ignore == undefined ) . forEach ( ( { name, value, type, description } ) => {
234+ type = replaceAll ( type , "|" , ", " ) ;
235+ agg += "\r\n | `" + name + "` | " + type + " | `" + value + "` | " + ( description || spaceCamelCaseName ( name ) ) + " | " ;
236+ } ) ;
237+ agg += "\r\n" ;
238+ } ) ;
239+ }
240+
241+ if ( callbackproperties != undefined && callbackproperties . length > 0 ) {
242+ agg += "\r\n**Events**" ;
243+ callbackproperties . filter ( item => item . ignore == undefined ) . forEach ( callback => {
244+ agg += create_function_md ( callback ) ;
214245 } ) ;
215- agg += "\r\n" ;
216246 }
217247 if ( functions . length > 0 ) {
218248 agg += "\r\n### Functions" ;
@@ -297,6 +327,7 @@ function getDoc(annotations) {
297327 annotation . constants = annotation . items . filter ( item => item . tag == "property" && item . constant == true ) . sort ( sortAnnotationsCallback ) ;
298328 annotation . properties = annotation . items . filter ( item => item . tag == "property" && item . constant == undefined ) . sort ( sortAnnotationsCallback ) ;
299329 annotation . functions = annotation . items . filter ( item => item . tag == "function" ) ;
330+ annotation . callbackproperties = annotation . items . filter ( item => item . tag == "event" ) ;
300331 annotation . callbacks = annotation . items . filter ( item => item . tag == "callback" ) ;
301332 return annotation ;
302333 } ) ;
@@ -438,6 +469,14 @@ function read_annotations(lines, parentTag) {
438469 annotation . value = options . value ;
439470 annotation . signature = options . signature ;
440471 }
472+ } else {
473+ var classItemLine = lines . shift ( ) ;
474+ if ( classItemLine != undefined && classItemLine . length > 0 ) {
475+ var options = get_class_item ( classItemLine ) ;
476+ annotation . tag = "event" ;
477+ annotation . name = options . name ;
478+ annotation . signature = get_signature ( annotation . params ) ;
479+ }
441480 }
442481 }
443482 break ;
@@ -568,9 +607,12 @@ function read_annotation(lines) {
568607 annotation . name = options2 . name ;
569608 annotation . items = read_annotations ( blockOfLines , tagName ) ;
570609 break ;
610+ case "group" :
611+ annotation . tag = tagName ;
612+ annotation . group = get_tag_description ( annotationLine ) ;
571613 case "classdesc" :
572614 if ( annotationLine != "" ) {
573- var description = get_tag_description ( annotationLine ) ; ;
615+ var description = get_tag_description ( annotationLine ) ;
574616 if ( descriptionTag . description == undefined ) {
575617 descriptionTag . description = description ;
576618 } else {
0 commit comments