关于RXjs多播实例

var test=Rx.Observable.create(function(observer){
           observer.next("hello")
           observer.next("some")
           observer.next("hi")
     })
     var test2=new Rx.Subject()
     var share=test.multicast(test2)
     var person1=share.subscribe({
         next:function(x){console.log(x)}
     })
     var person2=share.subscribe({
         next:function(x){console.log(x+"word");person1.unsubscribe()}
     })
    share.connect()

RXjs的文档 http://cn.rx.js.org/manual/overview.html

你可能感兴趣的:(关于RXjs多播实例)