1- import { Stream } from 'xstream' ;
2- import { Observable } from 'rxjs' ;
31import { run } from '@cycle/rxjs-run' ;
4- import { button , div , span , makeDOMDriver , DOMSource , VNode } from '@cycle/dom' ;
2+ import { Observable , of as observableOf } from 'rxjs' ;
3+ import { mapTo } from 'rxjs/operators' ;
4+ import { button , div , span , makeDOMDriver , VNode } from '@cycle/dom' ;
5+ import { DOMSource } from '@cycle/dom/lib/cjs/rxjs' ;
56import isolate from '@cycle/isolate' ;
67
78import { modalify , ModalAction } from '../../../src/modalify' ;
@@ -12,32 +13,34 @@ interface Sources {
1213
1314interface Sinks {
1415 DOM ?: Observable < VNode > ;
15- modal ?: Stream < ModalAction > ;
16+ modal ?: Observable < ModalAction > ;
1617}
1718
1819function main ( { DOM } : Sources ) : Sinks {
1920 return {
20- DOM : Observable . of ( button ( '.button' , [ 'open modal' ] ) ) ,
21+ DOM : observableOf ( button ( '.button' , [ 'open modal' ] ) ) ,
2122 modal : DOM . select ( '.button' )
2223 . events ( 'click' )
23- . mapTo ( {
24- type : 'open' ,
25- component : isolate ( modal )
26- } as ModalAction )
24+ . pipe (
25+ mapTo ( {
26+ type : 'open' ,
27+ component : isolate ( modal )
28+ } as ModalAction )
29+ )
2730 } ;
2831}
2932
3033function modal ( { DOM } : Sources ) : Sinks {
3134 return {
32- DOM : Observable . of (
35+ DOM : observableOf (
3336 div ( '.div' , [
3437 span ( '.span' , [ 'This is an rxjs modal! :)' ] ) ,
3538 button ( '.button' , [ 'close' ] )
3639 ] )
3740 ) ,
3841 modal : DOM . select ( '.button' )
3942 . events ( 'click' )
40- . mapTo ( { type : 'close' } as ModalAction )
43+ . pipe ( mapTo ( { type : 'close' } as ModalAction ) )
4144 } ;
4245}
4346
0 commit comments