mframejs
Version:
simple framework
33 lines • 1.71 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var exported_1 = require("../decorator/exported");
var exported_2 = require("../binding/exported");
var exported_3 = require("../utils/exported");
var createBindingContext_1 = require("../binding/createBindingContext");
var DelgateEventsAttribute = (function () {
function DelgateEventsAttribute() {
}
DelgateEventsAttribute.prototype.created = function () {
this.name = this.$attribute.name.replace('.delegate', '');
this.value = this.$attribute.value;
this.expressionValue = this.$attribute.value;
this.eventHandlerBinded = this.eventHandler.bind(this);
exported_3.connectBehavior(this.expressionValue, this);
this.$element.addEventListener(this.name, this.eventHandlerBinded, false);
};
DelgateEventsAttribute.prototype.attached = function () {
};
DelgateEventsAttribute.prototype.detached = function () {
this.$element.removeEventListener(this.name, this.eventHandlerBinded);
};
DelgateEventsAttribute.prototype.eventHandler = function (event) {
exported_2.BindingEngine.tokenizeParseAndTraverseAST(this.value, createBindingContext_1.createBindingContext(this.$bindingContext.$context, this.$bindingContext.$overrideContext, event));
};
DelgateEventsAttribute = tslib_1.__decorate([
exported_1.customAttribute('#VARIABLE#.delegate'),
tslib_1.__metadata("design:paramtypes", [])
], DelgateEventsAttribute);
return DelgateEventsAttribute;
}());
exports.DelgateEventsAttribute = DelgateEventsAttribute;
//# sourceMappingURL=delgateEventsAttribute.js.map