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
Improve shell's `Command`, `Command.stdout` and `Command.stderr` events with new `once`, `off`, `listenerCount`, `prependListener`, `prependOnceListener` and `removeAllListeners` functions.
addListener(eventName: E,listener: (...args: any[])=>void): this {
146
+
returnthis.on(eventName,listener)
147
+
}
148
+
149
+
/**
150
+
* Alias for `emitter.off(eventName, listener)`.
151
+
*/
152
+
removeListener(eventName: E,listener: (...args: any[])=>void): this {
153
+
returnthis.off(eventName,listener)
154
+
}
155
+
156
+
/**
157
+
* Adds the `listener` function to the end of the listeners array for the
158
+
* event named `eventName`. No checks are made to see if the `listener` has
159
+
* already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple
160
+
* times.
161
+
*
162
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
163
+
* @param eventName The name of the event.
164
+
* @param listener The callback function
165
+
*/
166
+
on(eventName: E,listener: (...args: any[])=>void): this {
* Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments
228
+
* to each.
167
229
*
168
-
* @param event The event name.
169
-
* @param handler The event handler.
230
+
* Returns `true` if the event had listeners, `false` otherwise.
* Adds the `listener` function to the _beginning_ of the listeners array for the
255
+
* event named `eventName`. No checks are made to see if the `listener` has
256
+
* already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple
257
+
* times.
170
258
*
171
-
* @return The `this` instance for chained calls.
259
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
* Adds a **one-time**`listener` function for the event named `eventName` to the_beginning_ of the listeners array. The next time `eventName` is triggered, this
276
+
* listener is removed, and then invoked.
277
+
*
278
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
279
+
* @param eventName The name of the event.
280
+
* @param listener The callback function
281
+
*/
282
+
prependOnceListener(eventName: E,listener: (...args: any[])=>void): this {
0 commit comments