@reactivex/ix-es2015-cjs
Version:
The Interactive Extensions for JavaScript
36 lines (34 loc) • 1.21 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.of = exports.OfAsyncIterable = void 0;
const tslib_1 = require("tslib");
const asynciterablex_js_1 = require("./asynciterablex.js");
const aborterror_js_1 = require("../aborterror.js");
/** @ignore */
class OfAsyncIterable extends asynciterablex_js_1.AsyncIterableX {
constructor(args) {
super();
this._args = args;
}
[Symbol.asyncIterator](signal) {
return tslib_1.__asyncGenerator(this, arguments, function* _a() {
(0, aborterror_js_1.throwIfAborted)(signal);
for (const item of this._args) {
yield yield tslib_1.__await(item);
}
});
}
}
exports.OfAsyncIterable = OfAsyncIterable;
/**
* Creates an async-iterable from the specified elements.
*
* @template TSource The type of the elements to create an async-iterable sequence.
* @param {...TSource[]} args The elements to turn into an async-iterable sequence.
* @returns {AsyncIterableX<TSource>} The async-iterable sequence created from the elements.
*/
function of(...args) {
return new OfAsyncIterable(args);
}
exports.of = of;
//# sourceMappingURL=of.js.map