import { Observable } from 'rxjs'; import { BsModalRef } from 'ngx-bootstrap'; /** * RxJS operator that unsubscribe from observables on destory. * Code forked from https://github.com/NetanelBasal/ngx-take-until-destroy * * IMPORTANT: Add the `untilDestroyed` operator as the last one to prevent leaks with intermediate observables in the * operator chain. * * @param instance The parent Angular component or object instance. * @param destroyMethodName The method to hook on (default: 'ngOnDestroy'). * @example * ``` * import { untilDestroyed } from '@app/core'; * * @Component({ * selector: 'app-example', * templateUrl: './example.component.html' * }) * export class ExampleComponent implements OnInit, OnDestroy { * ngOnInit() { * interval(1000) * .pipe(untilDestroyed(this)) * .subscribe(val => console.log(val)); * } * * // This method must be present, even if empty. * ngOnDestroy() { * // To protect you, an error will be thrown if it doesn't exist. * } * } * ``` */ export declare function untilDestroyed(instance: object, destroyMethodName?: string): (source: Observable) => Observable; /** * 页面Destroy时bsModal弹窗自动关闭 * * * IMPORTANT: Add the `bsModalUntilDestroyed` function to hide bsModal when destroyed * * @param instance The parent Angular component or object instance. * @param remove if true remove bsModalRef else add * @param destroyMethodName The method to hook on (default: 'ngOnDestroy'). * @example * ``` * * @Component({ * selector: 'app-example', * templateUrl: './example.component.html' * }) * export class ExampleComponent implements OnInit, OnDestroy { * * createForm() { * const bsModalRef = this.modalService.show(CreateFormComponent, { ignoreBackdropClick: true }); * bsModalUntilDestroyed(this, bsModalRef); * } * * // This method must be present, even if empty. * ngOnDestroy() { * // To protect you, an error will be thrown if it doesn't exist. * } * } * ``` */ export declare function bsModalUntilDestroyed(instance: object, bsModalRef: BsModalRef, remove?: boolean, destroyMethodName?: string): void;