UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

19 lines 751 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var observable_1 = require("../symbol/observable"); /** * Subscribes to an object that implements Symbol.observable with the given * Subscriber. * @param obj An object that implements Symbol.observable */ exports.subscribeToObservable = function (obj) { return function (subscriber) { var obs = obj[observable_1.observable](); if (typeof obs.subscribe !== 'function') { // Should be caught by observable subscribe function error handling. throw new TypeError('Provided object does not correctly implement Symbol.observable'); } else { return obs.subscribe(subscriber); } }; }; //# sourceMappingURL=subscribeToObservable.js.map