@@ -14,7 +14,7 @@ export class Components implements Disposable {
14
14
/**
15
15
* The version of the @thatopen/components library.
16
16
*/
17
- static readonly release = "2.2.11 " ;
17
+ static readonly release = "2.2.12 " ;
18
18
19
19
/** {@link Disposable.onDisposed } */
20
20
readonly onDisposed = new Event < void > ( ) ;
@@ -33,6 +33,26 @@ export class Components implements Disposable {
33
33
34
34
private _clock : THREE . Clock ;
35
35
36
+ /**
37
+ * Event that triggers the Components instance is initialized.
38
+ *
39
+ * @remarks
40
+ * This event is triggered once when the {@link Components.init} method has been called and finish processing.
41
+ * This is useful to set configuration placeholders that need to be executed when the components instance is initialized.
42
+ * For example, enabling and configuring custom effects in a post-production renderer.
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * const components = new Components();
47
+ * components.onInit.add(() => {
48
+ * // Enable custom effects in the post-production renderer
49
+ * // or any other operation dependant on the component initialization
50
+ * });
51
+ * components.init();
52
+ * ```
53
+ */
54
+ readonly onInit = new Event < undefined > ( ) ;
55
+
36
56
/**
37
57
* Adds a component to the list of components.
38
58
* Throws an error if a component with the same UUID already exists.
@@ -88,13 +108,12 @@ export class Components implements Disposable {
88
108
* Initializes the Components instance.
89
109
* This method starts the animation loop, sets the enabled flag to true,
90
110
* and calls the update method.
91
- *
92
- * @returns {void }
93
111
*/
94
112
init ( ) {
95
113
this . enabled = true ;
96
114
this . _clock . start ( ) ;
97
115
this . update ( ) ;
116
+ this . onInit . trigger ( ) ;
98
117
}
99
118
100
119
/**
0 commit comments