mframejs
Version:
simple framework
31 lines • 1.34 kB
JavaScript
import * as tslib_1 from "tslib";
import { customAttribute } from '../decorator/exported';
import { BindingEngine } from '../binding/exported';
import { connectBehavior } from '../utils/exported';
import { createBindingContext } from '../binding/createBindingContext';
let DelgateEventsAttribute = class DelgateEventsAttribute {
constructor() {
}
created() {
this.name = this.$attribute.name.replace('.delegate', '');
this.value = this.$attribute.value;
this.expressionValue = this.$attribute.value;
this.eventHandlerBinded = this.eventHandler.bind(this);
connectBehavior(this.expressionValue, this);
this.$element.addEventListener(this.name, this.eventHandlerBinded, false);
}
attached() {
}
detached() {
this.$element.removeEventListener(this.name, this.eventHandlerBinded);
}
eventHandler(event) {
BindingEngine.tokenizeParseAndTraverseAST(this.value, createBindingContext(this.$bindingContext.$context, this.$bindingContext.$overrideContext, event));
}
};
DelgateEventsAttribute = tslib_1.__decorate([
customAttribute('#VARIABLE#.delegate'),
tslib_1.__metadata("design:paramtypes", [])
], DelgateEventsAttribute);
export { DelgateEventsAttribute };
//# sourceMappingURL=delgateEventsAttribute.js.map