You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This type (`Parent`) is what should be exported and used by other code (_not_`_Parent`).
72
72
73
+
### Specifying Paths to Nested Event Locations with `AddEvents`
74
+
75
+
To accommodate complex class structures where events are organized within nested objects, the `AddEvents` utility allows specifying a path to these nested event locations. This feature enhances the ability to manage events in a structured manner within classes.
76
+
77
+
#### Enhancing Classes with Nested Events
78
+
79
+
For classes where events are nested within an object, you can specify the path to these nested events when enhancing your class. This approach helps maintain organized and encapsulated event structures.
80
+
81
+
**Example: Setting Up Nested Events**
82
+
83
+
Consider a class with events nested under a property called `eventsContainer`:
84
+
85
+
```typescript
86
+
// Define an interface
87
+
interfaceNestedEvents {
88
+
eventOne:TypedEvent<() =>void>;
89
+
}
90
+
91
+
// Define a class with nested events
92
+
class_Nested {
93
+
eventsContainer = {
94
+
eventOne: newTypedEvent<() =>void>()
95
+
};
96
+
}
97
+
98
+
// Enhance the class by specifying the path to nested events
If an incorrect path is provided, the utility throws an error. This ensures your event paths are correctly configured and provides immediate feedback for debugging.
110
+
111
+
**Example: Incorrect Path Configuration**
112
+
113
+
Here’s how errors are managed when an incorrect path is specified:
0 commit comments