You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.6 KiB
74 lines
2.6 KiB
4 years ago
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||
|
|
||
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||
|
|
||
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||
|
|
||
|
import { assign, defineProperty, defineProperties, readonlyDescriptor } from './object';
|
||
|
|
||
|
var BvEvent = /*#__PURE__*/function () {
|
||
|
function BvEvent(type) {
|
||
|
var eventInit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||
|
|
||
|
_classCallCheck(this, BvEvent);
|
||
|
|
||
|
// Start by emulating native Event constructor
|
||
|
if (!type) {
|
||
|
/* istanbul ignore next */
|
||
|
throw new TypeError("Failed to construct '".concat(this.constructor.name, "'. 1 argument required, ").concat(arguments.length, " given."));
|
||
|
} // Merge defaults first, the eventInit, and the type last
|
||
|
// so it can't be overwritten
|
||
|
|
||
|
|
||
|
assign(this, BvEvent.Defaults, this.constructor.Defaults, eventInit, {
|
||
|
type: type
|
||
|
}); // Freeze some props as readonly, but leave them enumerable
|
||
|
|
||
|
defineProperties(this, {
|
||
|
type: readonlyDescriptor(),
|
||
|
cancelable: readonlyDescriptor(),
|
||
|
nativeEvent: readonlyDescriptor(),
|
||
|
target: readonlyDescriptor(),
|
||
|
relatedTarget: readonlyDescriptor(),
|
||
|
vueTarget: readonlyDescriptor(),
|
||
|
componentId: readonlyDescriptor()
|
||
|
}); // Create a private variable using closure scoping
|
||
|
|
||
|
var defaultPrevented = false; // Recreate preventDefault method. One way setter
|
||
|
|
||
|
this.preventDefault = function preventDefault() {
|
||
|
if (this.cancelable) {
|
||
|
defaultPrevented = true;
|
||
|
}
|
||
|
}; // Create `defaultPrevented` publicly accessible prop that
|
||
|
// can only be altered by the preventDefault method
|
||
|
|
||
|
|
||
|
defineProperty(this, 'defaultPrevented', {
|
||
|
enumerable: true,
|
||
|
get: function get() {
|
||
|
return defaultPrevented;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
_createClass(BvEvent, null, [{
|
||
|
key: "Defaults",
|
||
|
get: function get() {
|
||
|
return {
|
||
|
type: '',
|
||
|
cancelable: true,
|
||
|
nativeEvent: null,
|
||
|
target: null,
|
||
|
relatedTarget: null,
|
||
|
vueTarget: null,
|
||
|
componentId: null
|
||
|
};
|
||
|
}
|
||
|
}]);
|
||
|
|
||
|
return BvEvent;
|
||
|
}(); // Named Exports
|
||
|
|
||
|
|
||
|
export { BvEvent };
|