UNPKG

1.18 kBJavaScriptView Raw
1import xs from 'xstream';
2import { adapt } from '@cycle/run/lib/adapt';
3import { fromEvent } from './fromEvent';
4var DocumentDOMSource = /** @class */ (function () {
5 function DocumentDOMSource(_name) {
6 this._name = _name;
7 }
8 DocumentDOMSource.prototype.select = function (selector) {
9 // This functionality is still undefined/undecided.
10 return this;
11 };
12 DocumentDOMSource.prototype.elements = function () {
13 var out = adapt(xs.of([document]));
14 out._isCycleSource = this._name;
15 return out;
16 };
17 DocumentDOMSource.prototype.element = function () {
18 var out = adapt(xs.of(document));
19 out._isCycleSource = this._name;
20 return out;
21 };
22 DocumentDOMSource.prototype.events = function (eventType, options, bubbles) {
23 if (options === void 0) { options = {}; }
24 var stream;
25 stream = fromEvent(document, eventType, options.useCapture, options.preventDefault);
26 var out = adapt(stream);
27 out._isCycleSource = this._name;
28 return out;
29 };
30 return DocumentDOMSource;
31}());
32export { DocumentDOMSource };
33//# sourceMappingURL=DocumentDOMSource.js.map
\No newline at end of file