66module Impl = (T : {type t ; }) => {
77 /**
88 * `addListener(emitter, event, listener)`
9- *
9+ *
1010 * Adds a new event listener function to the event emitter.
1111 */
1212 [@ bs . send ]
@@ -29,13 +29,12 @@ module Impl = (T: {type t;}) => {
2929 external listenerCount : (T . t , Event . t (' a => ' b , T . t )) => int =
3030 "listenerCount" ;
3131 [@ bs . send ]
32-
3332 external listeners : (T . t , Event . t (' a => ' b , T . t )) => array (' a => ' b ) =
3433 "listeners" ;
3534
3635 /**
3736 * `on(emitter, event, listener)`
38- *
37+ *
3938 * Adds a new event listener function to the event emitter.
4039 * Alias for `addListener`.
4140 */
@@ -44,7 +43,7 @@ module Impl = (T: {type t;}) => {
4443
4544 /**
4645 * `once(emitter, event, listener)`
47- *
46+ *
4847 * Adds a new **single-use** event listener function to the event
4948 * emitter. Then next time the given event is emitted, this listener
5049 * will fire exactly once, and then be removed from the emitter's
@@ -55,27 +54,27 @@ module Impl = (T: {type t;}) => {
5554
5655 /**
5756 * `off(emitter, event, listener)`
58- *
57+ *
5958 * Removes the listener function from the event emitter.
60- *
59+ *
6160 * The specified listener function is compared by **referential
6261 * equality** to each function in the emitter's internal listener
6362 * array.
64- *
63+ *
6564 * This means that, when the target listener is initially added, that
6665 * exact function reference must be maintained and provided here
6766 * in order to ensure removal.
68- *
67+ *
6968 * Alias for `removeListener`.
7069 */
7170 [@ bs . send ]
7271 external off : (T . t , Event . t (' a => ' b , T . t ), ' a => ' b ) => T . t = "off" ;
73-
72+
7473 /**
7574 * `prependListener(emitter, event, listener)`
76- *
75+ *
7776 * Adds a new event listener function to the event emitter.
78- *
77+ *
7978 * Unlike `on` and `addListener`, `prependListener` adds the listener
8079 * function to the front of the internal listener array, ensuring
8180 * that this function is called before the rest of the listeners for
@@ -87,12 +86,12 @@ module Impl = (T: {type t;}) => {
8786
8887 /**
8988 * `prependListenerOnce(emitter, event, listener)`
90- *
89+ *
9190 * Adds a new **single-use** event listener function to the event
9291 * emitter. Then next time the given event is emitted, this listener
9392 * will fire exactly once, and then be removed from the emitter's
9493 * internal listener array.
95- *
94+ *
9695 * Unlike `once`, `prependListenerOnce` adds the listener function
9796 * to the front of the internal listener array, ensuring that this
9897 * function is called before the rest of the listeners for the
@@ -106,13 +105,13 @@ module Impl = (T: {type t;}) => {
106105
107106 /**
108107 * `removeListener(emitter, event, listener)`
109- *
108+ *
110109 * Removes the listener function from the event emitter.
111- *
110+ *
112111 * The specified listener function is compared by **referential
113112 * equality** to each function in the emitter's internal listener
114113 * array.
115- *
114+ *
116115 * This means that, when the target listener is initially added, that
117116 * exact function reference must be maintained and provided here
118117 * in order to ensure removal.
@@ -123,35 +122,16 @@ module Impl = (T: {type t;}) => {
123122
124123 /**
125124 * `setMaxListeners(emitter, numberOfListeners)`
126- *
125+ *
127126 * Sets the maximum number of event listeners that may be added to
128127 * an event emitter before Node begins emitting warnings.
129- *
128+ *
130129 * By default, each event emitter has this value set to 10. This is
131130 * intended to warn the user about possible memory leaks.
132131 * `setMaxListeners` will increase this threshold.
133132 */
134- [@ bs . send ] external setMaxListeners : (T . t , int ) => T . t = "setMaxListeners" ;
135-
136133 [@ bs . send ]
137- external onNewListener :
138- (
139- T . t ,
140- [@ bs . as "newListener" ] _ ,
141- (Event . t (' a => ' b , T . t ), ' a => ' b ) => unit
142- ) =>
143- T . t =
144- "on" ;
145-
146- [@ bs . send ]
147- external onRemoveListener :
148- (
149- T . t ,
150- [@ bs . as "removeListener" ] _ ,
151- (Event . t (' a => ' b , T . t ), ' a => ' b ) => unit
152- ) =>
153- T . t =
154- "on" ;
134+ external setMaxListeners : (T . t , int ) => T . t = "setMaxListeners" ;
155135};
156136
157137/**
@@ -164,4 +144,4 @@ module Make = (()) => {
164144 type nonrec t = t ;
165145 });
166146 [@ bs . module "events" ] [@ bs . new ] external make : unit => t = "EventEmitter" ;
167- };
147+ };
0 commit comments