wargerm 0.7.29 → 0.7.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -433,7 +433,13 @@ var EventEmitter = /*#__PURE__*/_createClass(function EventEmitter() {
433
433
  }
434
434
  }
435
435
 
436
- _this.subscriptions.set(event, subscription);
436
+ if (_this.subscriptions.has(event)) {
437
+ var _this$subscriptions$g;
438
+
439
+ (_this$subscriptions$g = _this.subscriptions.get(event)) === null || _this$subscriptions$g === void 0 ? void 0 : _this$subscriptions$g.push(subscription);
440
+ } else {
441
+ _this.subscriptions.set(event, [subscription]);
442
+ }
437
443
 
438
444
  return function () {
439
445
  _this.subscriptions.delete(event);
@@ -445,14 +451,19 @@ var EventEmitter = /*#__PURE__*/_createClass(function EventEmitter() {
445
451
  if (typeof event === 'string' || typeof event === 'number') {
446
452
  var subscriptionValuesCallback = _this.subscriptions.get(event);
447
453
 
448
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
449
- args[_key - 1] = arguments[_key];
450
- }
454
+ if (subscriptionValuesCallback) {
455
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
456
+ args[_key - 1] = arguments[_key];
457
+ }
451
458
 
452
- subscriptionValuesCallback === null || subscriptionValuesCallback === void 0 ? void 0 : subscriptionValuesCallback({
453
- params: cloneDeep(args),
454
- event: event
455
- });
459
+ for (var i = 0; i < subscriptionValuesCallback.length; i++) {
460
+ var item = subscriptionValuesCallback[i];
461
+ item === null || item === void 0 ? void 0 : item({
462
+ event: event,
463
+ params: cloneDeep(args)
464
+ });
465
+ }
466
+ }
456
467
  } else throw new TypeError('event must be string or number !');
457
468
  };
458
469
 
package/dist/index.js CHANGED
@@ -477,7 +477,13 @@ var EventEmitter = /*#__PURE__*/_createClass(function EventEmitter() {
477
477
  }
478
478
  }
479
479
 
480
- _this.subscriptions.set(event, subscription);
480
+ if (_this.subscriptions.has(event)) {
481
+ var _this$subscriptions$g;
482
+
483
+ (_this$subscriptions$g = _this.subscriptions.get(event)) === null || _this$subscriptions$g === void 0 ? void 0 : _this$subscriptions$g.push(subscription);
484
+ } else {
485
+ _this.subscriptions.set(event, [subscription]);
486
+ }
481
487
 
482
488
  return function () {
483
489
  _this.subscriptions.delete(event);
@@ -489,14 +495,19 @@ var EventEmitter = /*#__PURE__*/_createClass(function EventEmitter() {
489
495
  if (typeof event === 'string' || typeof event === 'number') {
490
496
  var subscriptionValuesCallback = _this.subscriptions.get(event);
491
497
 
492
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
493
- args[_key - 1] = arguments[_key];
494
- }
498
+ if (subscriptionValuesCallback) {
499
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
500
+ args[_key - 1] = arguments[_key];
501
+ }
495
502
 
496
- subscriptionValuesCallback === null || subscriptionValuesCallback === void 0 ? void 0 : subscriptionValuesCallback({
497
- params: lodashEs.cloneDeep(args),
498
- event: event
499
- });
503
+ for (var i = 0; i < subscriptionValuesCallback.length; i++) {
504
+ var item = subscriptionValuesCallback[i];
505
+ item === null || item === void 0 ? void 0 : item({
506
+ event: event,
507
+ params: lodashEs.cloneDeep(args)
508
+ });
509
+ }
510
+ }
500
511
  } else throw new TypeError('event must be string or number !');
501
512
  };
502
513
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "wargerm",
4
- "version": "0.7.29",
4
+ "version": "0.7.30",
5
5
  "scripts": {
6
6
  "dev": "dumi dev",
7
7
  "docs:build": "dumi build",