‘liusuyi’
2023-05-24 0484a33f0550b344382f0d3caac5b26bbba23ca0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { Observable } from '../Observable';
import { innerFrom } from './innerFrom';
import { EMPTY } from './empty';
export function using(resourceFactory, observableFactory) {
    return new Observable((subscriber) => {
        const resource = resourceFactory();
        const result = observableFactory(resource);
        const source = result ? innerFrom(result) : EMPTY;
        source.subscribe(subscriber);
        return () => {
            if (resource) {
                resource.unsubscribe();
            }
        };
    });
}
//# sourceMappingURL=using.js.map