Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export function autoClearSubscriptions(constructor: Function) {
- return class extends constructor {
- ngOnDestroy() {
- console.log('Cleaning....')
- // Auto Clean things
- if(constructor.prototype.subscriptions) {
- return;
- }
- constructor.prototype.subscriptions.length = 0;
- // call the original method
- constructor.prototype.ngOnDestroy.apply(this, arguments);
- }
- }
- }
Add Comment
Please, Sign In to add comment