@@ -68,6 +68,17 @@ declare module './Model' {
6868
6969 interface Model < T > {
7070 addListener ( event : string , listener : any , arg2 ?: any , arg3 ?: any ) : any ;
71+ /**
72+ * Returns a child model based off the current model, with the specified "event context" tag
73+ * applied to all event listeners registered using that child model.
74+ *
75+ * `removeContextListeners()` can later be used to remove all listeners that were added with
76+ * that model's event context.
77+ *
78+ * Note that this has nothing to do with the `context(contextId)` method.
79+ *
80+ * @param id event context tag
81+ */
7182 eventContext ( id : string ) : ChildModel < T > ;
7283
7384 /**
@@ -153,6 +164,11 @@ declare module './Model' {
153164 pass ( object : object , invert ?: boolean ) : Model < T > ;
154165
155166 removeAllListeners ( type : string , subpath : Path ) : void ;
167+ /**
168+ * Remove all listeners that were registered with this model's event context.
169+ *
170+ * @see {@link eventContext }
171+ */
156172 removeContextListeners ( ) : void ;
157173
158174 removeListener ( eventType : keyof ModelOnEventMap | keyof ModelOnImmediateEventMap | 'all' , listener : Function ) : void ;
@@ -171,8 +187,16 @@ declare module './Model' {
171187 _emitError ( err : Error , context ?: any ) : void ;
172188 _emitMutation ( segments : Segments , event : any ) : void ;
173189 _emittingMutation : boolean ;
174- _eventContextListeners : Record < string , any > ;
190+ /**
191+ * Map of "event context" name to an array of listeners with that event context
192+ *
193+ * @see {@link _eventContext }
194+ */
195+ _eventContextListeners : Record < string , MutationListener [ ] > ;
175196 _mutationEventQueue : null ;
197+ /**
198+ * Map of event type to mutation listener tree for that type
199+ */
176200 _mutationListeners : Record < string , EventListenerTree > ;
177201 _removeAllListeners ( type : string , segments : Segments ) : void ;
178202 _removeMutationListener ( listener : MutationListener ) : void ;
0 commit comments