Can I observe additions to an array with rx.js?

前端 未结 4 1488
梦如初夏
梦如初夏 2020-12-30 00:34

fromArray Rx wiki on github

coffee> rext = require \'rx\'                                                 
coffee> arr = [1..5]                                 


        
4条回答
  •  情深已故
    2020-12-30 01:02

    Observable.fromArray creates an Observable that immediately fires events for each array items, when you add a Subscriber. So, it won't be "watching" the changes to that array.

    If you need a "pushable collection", the Bus class in Bacon.js might be what you're looking for. For RxJs there's my little MessageQueue class that has a similar functionality.

提交回复
热议问题