import xs , { Stream , MemoryStream } from 'xstream' ; import { adapt } from '@cycle/run/lib/adapt' ; import { DevToolEnabledSource } from '@cycle/run' ; import { EventsFnOptions , DOMSource } from './DOMSource' ; import { fromEvent } from './fromEvent' ; export class DocumentDOMSource { constructor ( private _name ) { } public select ( selector ) { return this ; } public elements ( ) { const out = adapt ( xs . of ( [ document ] ) ) ; out . _isCycleSource = this . _name ; return out ; } public element ( ) { const out = adapt ( xs . of ( document ) ) ; out . _isCycleSource = this . _name ; return out ; } public events < K extends keyof DocumentEventMap > ( eventType , options ? , bubbles ? ) ; public events ( eventType , options = { } , bubbles ? ) { let stream ; stream = fromEvent ( document , eventType , options . useCapture , options . preventDefault ) ; const out = adapt ( stream ) ; out . _isCycleSource = this . _name ; return out ; } }