"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var rxjs_1 = require("rxjs");
var operators_1 = require("rxjs/operators");
var ObservableHelper = /** @class */ (function () {
    function ObservableHelper() {
    }
    ObservableHelper.timeout = function (obs, timeout, errorFactory) {
        if (timeout) {
            obs = obs.pipe(operators_1.timeout(timeout), operators_1.catchError(function (err) {
                if (errorFactory && err instanceof rxjs_1.TimeoutError) {
                    throw errorFactory(err);
                }
                throw err;
            }));
        }
        return obs;
    };
    return ObservableHelper;
}());
exports.ObservableHelper = ObservableHelper;
