(eventPath: string, collection: any)
| 113 | } |
| 114 | |
| 115 | unsubscribe(eventPath: string, collection: any) { |
| 116 | const subscribersForPath = this.getSubscribersList(eventPath); |
| 117 | const pos = subscribersForPath.indexOf(collection); |
| 118 | if (pos >= 0) { |
| 119 | subscribersForPath.splice(pos, 1); |
| 120 | if (subscribersForPath.length === 0) { |
| 121 | return this.send({ |
| 122 | cmd: "stopConsuming", |
| 123 | path: eventPath |
| 124 | }); |
| 125 | } |
| 126 | } |
| 127 | return Promise.resolve(); |
| 128 | } |
| 129 | |
| 130 | private getSubscribersList(eventPath: string) { |
| 131 | if (!(eventPath in this.subscribers)) { |
no test coverage detected