Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export function AutoUnsubscribe( constructor ) {
- const original = constructor.prototype.ngOnDestroy;
- constructor.prototype.ngOnDestroy = function () {
- for ( let prop in this ) {
- const property = this[ prop ];
- if ( property && (typeof property.unsubscribe === "function") ) {
- property.unsubscribe();
- }
- }
- original && typeof original === "function" && original.apply(this, arguments);
- };
- }
Add Comment
Please, Sign In to add comment