ngx-decorate
Version:
Useful decorators for Angular 2 and above
32 lines • 730 B
JavaScript
import { _subscrToSubs, _unsubscribe } from '../lib/symbols';
/** @internal */
function unsubArray(props) {
for (const sub of props) {
sub.unsubscribe();
}
}
/** @internal */
function processProp(prop) {
if (prop) {
if (Array.isArray(prop)) {
unsubArray(prop);
}
else {
prop.unsubscribe();
}
}
}
/** @internal */
export function unsubscribe(self) {
if (self[_unsubscribe]) {
for (const prop of self[_unsubscribe]) {
processProp(self[prop]);
}
}
if (self[_subscrToSubs]) {
for (const prop of self[_subscrToSubs]) {
processProp(prop);
}
}
}
//# sourceMappingURL=unsubscribe.js.map