1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.publish = publish;
|
7 |
|
8 | var _minimatch = require('minimatch');
|
9 |
|
10 | var _minimatch2 = _interopRequireDefault(_minimatch);
|
11 |
|
12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13 |
|
14 | function publish(channel, message) {
|
15 | var _this = this;
|
16 |
|
17 | this.channels.emit(channel, message);
|
18 | var matchingPatterns = this.patternChannels.eventNames().filter(function (pattern) {
|
19 | return (0, _minimatch2.default)(channel, pattern);
|
20 | });
|
21 | matchingPatterns.forEach(function (matchingChannel) {
|
22 | return _this.patternChannels.emit(matchingChannel, message, channel);
|
23 | });
|
24 | var numberOfSubscribers = matchingPatterns.length + this.channels.listenerCount(channel);
|
25 | return numberOfSubscribers;
|
26 | } |
\ | No newline at end of file |