import { Observable } from '../Observable'; import { isFunction } from '../util/isFunction'; import { mapOneOrManyArgs } from '../util/mapOneOrManyArgs'; export function fromEventPattern(addHandler, removeHandler, resultSelector) { if (resultSelector) { return fromEventPattern(addHandler, removeHandler).pipe(mapOneOrManyArgs(resultSelector)); } return new Observable(function (subscriber) { var handler = function () { var e = []; for (var _i = 0; _i < arguments.length; _i++) { e[_i] = arguments[_i]; } return subscriber.next(e.length === 1 ? e[0] : e); }; var retValue = addHandler(handler); return isFunction(removeHandler) ? function () { return removeHandler(handler, retValue); } : undefined; }); } //# sourceMappingURL=fromEventPattern.js.map