vasille
Version:
The first Developer eXperience Orientated front-end framework (core library).
29 lines (28 loc) • 625 B
JavaScript
import { Destroyable } from "../../../core/destroyable.js";
/**
* Describe a common binding logic
* @class Binding
* @extends Destroyable
*/
export class Binding extends Destroyable {
/**
* Constructs a common binding logic
* @param value {IValue} the value to bind
*/
constructor(value) {
super();
this.binding = value;
}
init(bounded) {
this.func = bounded;
this.binding.on(this.func);
this.func(this.binding.$);
}
/**
* Just clear bindings
*/
destroy() {
this.binding.off(this.func);
super.destroy();
}
}