Guest User

Untitled

a guest
Dec 9th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. export function autoClearSubscriptions(constructor: Function) {
  2. return class extends constructor {
  3. ngOnDestroy() {
  4. console.log('Cleaning....')
  5. // Auto Clean things
  6. if(constructor.prototype.subscriptions) {
  7. return;
  8. }
  9. constructor.prototype.subscriptions.length = 0;
  10. // call the original method
  11. constructor.prototype.ngOnDestroy.apply(this, arguments);
  12. }
  13. }
  14. }
Add Comment
Please, Sign In to add comment