Comparing version 2.2.0 to 2.3.0
@@ -11,2 +11,4 @@ "use strict"; | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
@@ -35,2 +37,4 @@ | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
_ref$defaultOptions = _ref.defaultOptions, | ||
defaultOptions = _ref$defaultOptions === void 0 ? {} : _ref$defaultOptions, | ||
_ref$name = _ref.name, | ||
@@ -40,2 +44,3 @@ name = _ref$name === void 0 ? "events" : _ref$name; | ||
(0, _classCallCheck2.default)(this, Events); | ||
this.defaultOptions = defaultOptions; | ||
this.name = name; | ||
@@ -82,2 +87,8 @@ this.ops = new Set(); | ||
(0, _createClass2.default)(Events, [{ | ||
key: "setDefaultOptions", | ||
value: function setDefaultOptions(options) { | ||
this.defaultOptions = (0, _objectSpread2.default)({}, this.defaultOptions, options); | ||
return this; | ||
} | ||
}, { | ||
key: "setOp", | ||
@@ -84,0 +95,0 @@ value: function setOp(op) { |
@@ -45,2 +45,3 @@ "use strict"; | ||
emitEvent: emitEvent, | ||
events: events, | ||
options: options, | ||
@@ -66,2 +67,3 @@ props: props | ||
emitEvent = _ref2.emitEvent, | ||
events = _ref2.events, | ||
options = _ref2.options, | ||
@@ -75,3 +77,3 @@ props = _ref2.props; | ||
}); | ||
return Object.assign({}, emitEvent.options, options, wildcardVar, emitArgs && (0, _util.isObject)(emitArgs[0]) ? emitArgs[0] : undefined); | ||
return Object.assign({}, events.defaultOptions, emitEvent.options, options, wildcardVar, emitArgs && (0, _util.isObject)(emitArgs[0]) ? emitArgs[0] : undefined); | ||
} else { | ||
@@ -78,0 +80,0 @@ return options; |
@@ -13,3 +13,7 @@ // Helpers | ||
export class Events { | ||
constructor({ name = "events" } = {}) { | ||
constructor({ | ||
defaultOptions = {}, | ||
name = "events", | ||
} = {}) { | ||
this.defaultOptions = defaultOptions | ||
this.name = name | ||
@@ -35,2 +39,10 @@ this.ops = new Set() | ||
setDefaultOptions(options) { | ||
this.defaultOptions = { | ||
...this.defaultOptions, | ||
...options, | ||
} | ||
return this | ||
} | ||
setOp(op) { | ||
@@ -37,0 +49,0 @@ opBase({ op, options: { events: this } }) |
@@ -26,2 +26,3 @@ import { propVar } from "./props" | ||
emitEvent, | ||
events, | ||
options, | ||
@@ -59,2 +60,3 @@ props, | ||
emitEvent, | ||
events, | ||
options, | ||
@@ -71,2 +73,3 @@ props, | ||
{}, | ||
events.defaultOptions, | ||
emitEvent.options, | ||
@@ -73,0 +76,0 @@ options, |
@@ -15,3 +15,3 @@ { | ||
], | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "Build beautiful and extensible eventing APIs", | ||
@@ -18,0 +18,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
123287
2261