KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
fromArray Rx wiki on github coffee> rext = require 'rx' coffee> arr = [1..5] [ 1, 2, 3, 4, 5 ] coffee> obs = rext.Observable.fromArray(arr) { _subscribe: [Function] } coffee> obs.subscribe( (x) -> console.log("added value: " + x)) added value: 1 added value: 2 added value: 3 added value: 4 added value: 5 { isStopped: true, observer: { isStopped: true, _onNext: [Function], _onError: [Function: defaultError], _onCompleted: [Function: noop] }, m: { isDisposed: true, current: null } } coffee> arr.push(12) # expecting "added value: 12" 6 # instead got new length of array coffee> It really looks like the subscribe function will only fire one time, when it's created. It seems like it's a bit of a misnomer, since I'm really just for-eaching the array instead of observing changes on it. That code is almost exactly the same as what's on the wiki though. So either I'm doing it wrong or
Tags (comma-separated)
Save Edits
Cancel