app-decorators
Version:
Collection of useful ES7 Decorators, writtin in ES6, that can be used for building webapps
86 lines (74 loc) • 2.25 kB
JavaScript
System.register(["app-decorators/src/libs/element-to-function"], function (_export, _context) {
"use strict";
var _elementToFunc, _createClass, Event;
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
return {
setters: [function (_appDecoratorsSrcLibsElementToFunction) {
_elementToFunc = _appDecoratorsSrcLibsElementToFunction.default;
}],
execute: function () {
_createClass = 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);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
_export("Event", Event = function () {
_createClass(Event, [{
key: "preventDefault",
value: function preventDefault() {}
}, {
key: "stopPropagation",
value: function stopPropagation() {}
}]);
function Event(type, config) {
_classCallCheck(this, Event);
this.bubbles = false;
this.cancelBubble = false;
this.cancelable = false;
this.composed = false;
this.currentTarget = null;
this.defaultPrevented = false;
this.eventPhase = 0;
this.isTrusted = false;
this.path = [];
this.returnValue = true;
this.srcElement = null;
this.target = null;
this.timeStamp = null;
this.type = null;
Object.assign(this, config, { type: type });
this._init();
}
_createClass(Event, [{
key: "_init",
value: function _init() {
this._setTimestamp();
}
}, {
key: "_setTimestamp",
value: function _setTimestamp() {
this.timeStamp = new Date().getTime();
}
}]);
return Event;
}());
_export("Event", Event);
}
};
});
//# sourceMappingURL=event.js.map