-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
79 lines (59 loc) · 2.42 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
const StreamDemux = require('stream-demux');
function AsyncStreamEmitter(options) {
this._listenerDemux = new StreamDemux();
}
AsyncStreamEmitter.prototype.emit = function (eventName, data) {
this._listenerDemux.write(eventName, data);
};
AsyncStreamEmitter.prototype.listener = function (eventName) {
return this._listenerDemux.stream(eventName);
};
AsyncStreamEmitter.prototype.closeListener = function (eventName) {
this._listenerDemux.close(eventName);
};
AsyncStreamEmitter.prototype.closeAllListeners = function () {
this._listenerDemux.closeAll();
};
AsyncStreamEmitter.prototype.removeListener = function (eventName) {
this._listenerDemux.unstream(eventName);
};
AsyncStreamEmitter.prototype.getListenerConsumerStats = function (consumerId) {
return this._listenerDemux.getConsumerStats(consumerId);
};
AsyncStreamEmitter.prototype.getListenerConsumerStatsList = function (eventName) {
return this._listenerDemux.getConsumerStatsList(eventName);
};
AsyncStreamEmitter.prototype.getAllListenersConsumerStatsList = function () {
return this._listenerDemux.getConsumerStatsListAll();
};
AsyncStreamEmitter.prototype.getListenerConsumerCount = function (eventName) {
return this._listenerDemux.getConsumerCount(eventName);
};
AsyncStreamEmitter.prototype.getAllListenersConsumerCount = function () {
return this._listenerDemux.getConsumerCountAll();
};
AsyncStreamEmitter.prototype.killListener = function (eventName) {
this._listenerDemux.kill(eventName);
};
AsyncStreamEmitter.prototype.killAllListeners = function () {
this._listenerDemux.killAll();
};
AsyncStreamEmitter.prototype.killListenerConsumer = function (consumerId) {
this._listenerDemux.killConsumer(consumerId);
};
AsyncStreamEmitter.prototype.getListenerBackpressure = function (eventName) {
return this._listenerDemux.getBackpressure(eventName);
};
AsyncStreamEmitter.prototype.getAllListenersBackpressure = function () {
return this._listenerDemux.getBackpressureAll();
};
AsyncStreamEmitter.prototype.getListenerConsumerBackpressure = function (consumerId) {
return this._listenerDemux.getConsumerBackpressure(consumerId);
};
AsyncStreamEmitter.prototype.hasListenerConsumer = function (eventName, consumerId) {
return this._listenerDemux.hasConsumer(eventName, consumerId);
};
AsyncStreamEmitter.prototype.hasAnyListenerConsumer = function (consumerId) {
return this._listenerDemux.hasConsumerAll(consumerId);
};
module.exports = AsyncStreamEmitter;