node_modules

This commit is contained in:
saeid
2019-07-15 13:07:31 +04:30
parent d3735c6d30
commit ce1a3ebf9c
35713 changed files with 3639219 additions and 1 deletions
+33
View File
@@ -0,0 +1,33 @@
/** PURE_IMPORTS_START _Observable,_from,_empty PURE_IMPORTS_END */
import { Observable } from '../Observable';
import { from } from './from';
import { EMPTY } from './empty';
export function using(resourceFactory, observableFactory) {
return new Observable(function (subscriber) {
var resource;
try {
resource = resourceFactory();
}
catch (err) {
subscriber.error(err);
return undefined;
}
var result;
try {
result = observableFactory(resource);
}
catch (err) {
subscriber.error(err);
return undefined;
}
var source = result ? from(result) : EMPTY;
var subscription = source.subscribe(subscriber);
return function () {
subscription.unsubscribe();
if (resource) {
resource.unsubscribe();
}
};
});
}
//# sourceMappingURL=using.js.map