chore(core): deprecate the takeUntilDestroy

#4818
pull/4849/head
mehmet-erim 5 years ago
parent 436ad0ff91
commit 8c50cdb7d9

@ -1,3 +1,4 @@
// tslint:disable: max-line-length
import { Observable, Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@ -5,13 +6,16 @@ function isFunction(value) {
return typeof value === 'function';
}
/**
* @deprecated no longer working, please use SubscriptionService (https://docs.abp.io/en/abp/latest/UI/Angular/Subscription-Service) instead.
*/
export const takeUntilDestroy = (componentInstance, destroyMethodName = 'ngOnDestroy') => <T>(
source: Observable<T>
source: Observable<T>,
) => {
const originalDestroy = componentInstance[destroyMethodName];
if (isFunction(originalDestroy) === false) {
throw new Error(
`${componentInstance.constructor.name} is using untilDestroyed but doesn't implement ${destroyMethodName}`
`${componentInstance.constructor.name} is using untilDestroyed but doesn't implement ${destroyMethodName}`,
);
}
if (!componentInstance['__takeUntilDestroy']) {

Loading…
Cancel
Save