Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 29x 29x 29x 138x 114x 1014x 1014x 1014x 1014x 114x 114x 114x 114x | import { CONSTANTS, IElement, IAttribute } from '../interface/exported';
import { unSubscribeClassProperty } from './property/unSubscribeClassProperty';
/**
* unsubscribe class observables/meta binding
*
*/
export function unSubscribeClassMetaBinding(_class: IElement | IAttribute) {
const META = (<any>_class).__proto__[CONSTANTS.META_BINDABLE];
if (META) {
const keys = Object.keys(META);
for (const key of keys) {
// save key
const CLASSMETA = (_class as any).__metaBinding[key];
const subscribeInternal = CLASSMETA.options.subscribeInternal;
// if it exist unsubscribe
if (subscribeInternal) {
unSubscribeClassProperty(_class.$bindingContext, subscribeInternal);
}
// get old
const subscribeExternal = CLASSMETA.options.subscribeExternal;
// if it exist unsubscribe
if (_class.$bindingContext && subscribeExternal) {
if (_class.$element) {
const el = _class.$element as Element;
const att = `${META[key].options.attribute}.bind`;
const attrValue = el.getAttribute(att);
if (attrValue) {
unSubscribeClassProperty(_class.$bindingContext, subscribeExternal);
}
}
}
}
}
}
|