@cycle/dom
Version:
The standard DOM Driver for Cycle.js, based on Snabbdom
33 lines • 1.18 kB
JavaScript
import xs from 'xstream';
import { adapt } from '@cycle/run/lib/adapt';
import { fromEvent } from './fromEvent';
var DocumentDOMSource = /** @class */ (function () {
function DocumentDOMSource(_name) {
this._name = _name;
}
DocumentDOMSource.prototype.select = function (selector) {
// This functionality is still undefined/undecided.
return this;
};
DocumentDOMSource.prototype.elements = function () {
var out = adapt(xs.of([document]));
out._isCycleSource = this._name;
return out;
};
DocumentDOMSource.prototype.element = function () {
var out = adapt(xs.of(document));
out._isCycleSource = this._name;
return out;
};
DocumentDOMSource.prototype.events = function (eventType, options, bubbles) {
if (options === void 0) { options = {}; }
var stream;
stream = fromEvent(document, eventType, options.useCapture, options.preventDefault);
var out = adapt(stream);
out._isCycleSource = this._name;
return out;
};
return DocumentDOMSource;
}());
export { DocumentDOMSource };
//# sourceMappingURL=DocumentDOMSource.js.map