File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 1
1
export const ApplicationEvents = {
2
2
BOOTSTRAP_END : "bootstrapEnd" ,
3
- } ;
3
+ VALIDATION_RUN : "validationRun" ,
4
+ } as const ;
Original file line number Diff line number Diff line change @@ -107,6 +107,12 @@ export class Application extends ChildableComponent<
107
107
*/
108
108
static readonly EVENT_BOOTSTRAP_END = ApplicationEvents . BOOTSTRAP_END ;
109
109
110
+ /**
111
+ * Emitted when validation is being run.
112
+ * The listener will be given an instance of {@link ProjectReflection}.
113
+ */
114
+ static readonly EVENT_VALIDATION_RUN = ApplicationEvents . VALIDATION_RUN ;
115
+
110
116
/**
111
117
* Create a new TypeDoc application instance.
112
118
*/
@@ -431,6 +437,8 @@ export class Application extends ChildableComponent<
431
437
validateLinks ( project , this . logger ) ;
432
438
}
433
439
440
+ this . trigger ( Application . EVENT_VALIDATION_RUN , project ) ;
441
+
434
442
this . logger . verbose ( `Validation took ${ Date . now ( ) - start } ms` ) ;
435
443
}
436
444
Original file line number Diff line number Diff line change 7
7
// The Events object is a typesafe conversion of Backbones Events object:
8
8
// https://github.com/jashkenas/backbone/blob/05fde9e201f7e2137796663081105cd6dad12a98/backbone.js#L119-L374
9
9
10
+ import type { ProjectReflection } from "../models/index" ;
11
+ import type { Application } from "../application" ;
12
+
10
13
const uniqueId = ( function ( ) {
11
14
const prefixes : Record < string , number | undefined > = Object . create ( null ) ;
12
15
return function ( prefix : string ) {
@@ -433,6 +436,12 @@ export class EventDispatcher {
433
436
context ?: any ,
434
437
priority ?: number
435
438
) : this;
439
+ on (
440
+ name : ( typeof Application ) [ "EVENT_VALIDATION_RUN" ] ,
441
+ callback : ( project : ProjectReflection ) => void ,
442
+ context ?: any ,
443
+ priority ?: number
444
+ ) : this;
436
445
on (
437
446
name : string ,
438
447
callback : EventCallback ,
@@ -441,7 +450,7 @@ export class EventDispatcher {
441
450
) : this;
442
451
on (
443
452
nameOrMap : EventMap | string ,
444
- callback : EventCallback ,
453
+ callback ? : EventCallback ,
445
454
context ?: any ,
446
455
priority ?: number
447
456
) {
You can’t perform that action at this time.
0 commit comments