Coder Social home page Coder Social logo

rxjs's People

Contributors

38elements avatar atticoos avatar bartdesmet avatar benlesh avatar bouzuya avatar chetharrison avatar chicoxyzzy avatar david-driscoll avatar gordey4doronin avatar igorbek avatar jacksky007 avatar jca02266 avatar jhusain avatar jmalonzo avatar l8d avatar mattpodwysocki avatar paddlefish avatar paulpdaniels avatar raineratspirit avatar rhendric avatar scouten-adobe avatar sirbarrence avatar staltz avatar tavisrudd avatar theghostbel avatar urmastalimaa avatar widdershin avatar xgrommx avatar yungsters avatar zalastax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rxjs's Issues

Subscribe and timeout

How can I get a each value with timeout in subscribe?

For example now I try it, but it work for all collection in unlike for each value of collection.

            Rx.Observable.fromArray([1,2,3,4,5,6,7]).delay(2000).subscribe(
                    function(v) {
                        console.log(v);
                    },
                    function(err) {

                    },
                    function() {
                        console.log('All done');
                    }); 

rx-dom cannot be installed with bower

bower info rx reports the package as non-existent, but bower info rx-dom reports the rx package as a dependency. The net effect is that rx-dom cannot be installed.

The only existent package right now is rxjs. Not sure where the problem lies, but personally I prefer rxjs being renamed to rx. Sounds better IMHO, and that's why I added this issue here instead of using the rx-dom repo.

Bad filenames in RxJs-Main nuget package

These are the files in the packages (likes like we got x instead of rx for some of the files):

$ ls -l packages/RxJS-Main.2.2.0/content/Scripts
total 215
-rw-r--r--    1 Brandon. Administ   181727 Nov 17 14:19 rx.compat.js
-rw-r--r--    1 Brandon. Administ   177601 Nov 17 14:19 rx.js
-rw-r--r--    1 Brandon. Administ    40293 Nov 17 14:19 x.compat.min.js
-rw-r--r--    1 Brandon. Administ    38574 Nov 17 14:19 x.min.js

Rework docs

  1. No need in # link under the titles because when you hover the title it shows generated link for you
  2. Remove or make auto link for โ“ˆ link because all of the links in docs pointing on wrong lines numbers

Maybe remove both of that links and put Location file name on that line? If you agree, I can do that.

rxjs-modern is missing from nuget.org

rxjs-coincidence has a dependency on rxjs-modern which is not published to nuget.org

Therefore updating to latest version fails.

Trying to install rxjs-all also fails for the same reason.

How to extend Rx.Observable.prototype?

Hello,

How can i extend Rx.Observable.prototype in nodejs?

Let say i have the following project structure:

lib
|----rx
|----rx-fs
|    |
|    `----rx
|
`----rx-utils
     |
     `----rx

All changes made in rx-fs are not visible in rx-utils and in lib because they have their own copy of Rx;

I would like to write the code below in lib module:

rxfs
    .readFile("file.txt")    //rx-fs
    .concatBuffers()       //rx-utils
    .subscribe(function (buffer) { ... }, ...);

How can i extend Rx.Observable.prototype in nodejs?

Thanks

Define rx.lite.js

Until we have custom builds under hand, would it make sense to create a smaller version of RxJS called RxLite which has a few operators. Which operators might fit?

Thoughts include the following:

Creation Operators

  • create
  • createWithDisposable
  • empty
  • fromArray
  • fromCallback
  • fromEvent
  • fromEventPattern
  • fromNodeCallback
  • fromPromise
  • interval
  • merge
  • never
  • repeat
  • return
  • timer

Combinators

  • do
  • map/select
  • filter/where
  • flatMap/selectMany
  • flatMapLatest/selectSwitch
  • combineLatest
  • zip
  • distinctUntilChanged
  • concat
  • concatObservable
  • merge
  • mergeObservable
  • multicast
  • publish
  • publishLatest
  • publishValue
  • repeat
  • replay
  • skip
  • skipUntil
  • skipWhile
  • take
  • takeUntil
  • takeWhile
  • throttle
  • timestamp
  • timeinterval
  • toArray

Any that I'm missing that are high priority?

switchLatest() defeats distinctUntilChanged()

I'm trying to follow the patterns in the examples, that look something like

return anObservable.distinctUntilChanged()
    .select(function (d) { return $.postAsObservable(d); })
    .switchLatest();

However the switchLatest() creates new subscriptions on the observable, such that the distinctUntilChanged() is defeated (it's always a new stream), and duplicate requests are sent to the server. I can work around this with publish().

var reqs = anObservable.distinctUntilChanged()
      .select(function(d) { return $.postAsObservable(d); })
      .publish();
reqs.connect();
return reqs.switchLatest();

but it's awkward, and the examples suggest the simpler pattern should work.

Make versions for compat and move rx.modern.js to rx.js

Since others such as jQuery and lodash are making the move to dropping older browsers from mainline support, it's about time RxJS does the same. Instead of shipping rx.modern.js, we will ship it as rx.js and maintain the existing rx.js as rx.compat.js.

Going forward, you can use an ES5 shim library to polyfill behavior such as Function#bind, and Array#extras which is all that RxJS relies upon.

Roadmap for 2.3

Version 2.3:

  • Query Expressions for both RxJS and IxJS
  • Revisit Backpressure?
  • Investigate ES6 implications

Possible bug with merge

I tried to port over Dave Sextons' method for forkJoin to bring it back for the latest RxJS release. As Matt pointed out, it will come back with rx-experimential.js but in the mean time one could use this.

However, when I translate it one by one it doesnt work:

Rx.Observable.forkJoin = function (sources) {
        return Rx.Observable.fromArray(sources)
                .select(function(o, i) {
                     return o.takeLast(1).select(function(value) { return { i: i, value: value }; });
                })
                .merge(null)
                .aggregate({ array: [], count: 0 }, function(results, result) {
                    results.array[result.i] = result.value;
                    return {
                        array: results.array,
                        count: results.count + 1
                    };
                })
                .where(function(results) { return results.count === sources.length; })
                .select(function(results) { return results.array; });
    };

instead I have to do it like this:

Rx.Observable.forkJoin = function (sources) {
        return Rx.Observable.fromArray(sources)
                .selectMany(function(o, i) {
                     return o.takeLast(1).select(function(value) { return { i: i, value: value }; });
                })
                .aggregate({ array: [], count: 0 }, function(results, result) {
                    results.array[result.i] = result.value;
                    return {
                        array: results.array,
                        count: results.count + 1
                    };
                })
                .where(function(results) { return results.count === sources.length; })
                .select(function(results) { return results.array; });
    };

API docs?

The docs look mostly incomplete. I understand this is based on Rx for .NET, so perhaps the Rx docs would do, but I can't find Rx docs, either, apart from some very high-level videos on msdn. Where's the API reference?

Update or at least remove generated content

The current landing page has all the default content from the Github Pages generator. Rather than leaving the default, remove it or update it with something even a bit more informative, such as links to the Rx MSDN site or Channel 9 content.

Scan with multiple subscribers results in weird behaviour

I have an ClojureScript app which uses Observable.scan to implement global state change on signal changes. That worked out pretty well until I started having multiple subscribers for global state change.

Namely, the state in one of subscribers is different from the state in the other ones. Trying to understand how is that possible I've noticed that my aggregating function is called twice per every state change. It seems that somehow the signal paths diverged and it all got mixed up.

The case of aggregation function being called twice was easily reproduced:

http://jsfiddle.net/4AayC/2/ (yes it's a weird example)

I'm not really sure how to reproduce difference in states easily, my few attempts were failed.

I suspect that there may be a problem in how I use the scan method (documentation is particularly helpful on this one ;-) ) or on my approach to the overall system design, however I have no clue where exactly my error is.

I'm not relying on any global variables in my own code, it all is pure. I can try to provide some more info somehow (maybe even show the code, if ClojureScript is okay), if it's needed. Maybe it's a ClojureScript bug, some pure operation does not happen to actually be pure; however in the JavaScript world accidentally impure operations are a norm, so it's hard to imagine RxJS being better in this case with JS than CS.

Incomplete Array#indexOf polyfill

Hi,

The implemented indexOf Array polyfill yields an incorrect result when called with undefined as the second argument (fromIndex).

The polyfill should default to 0 when a non-Integer fromIndex value is encountered.

This affects IE version 8 and below.

Test case:
[1,2,3,4].indexOf(3, undefined);

Expected result: 2
Actual result: -1

Thanks,

  • Ewan

selectManyLatest Issue

Hi there,
I think there is an issue with either doc or this function, when I try to run the example in docs, it says cannot subscribe to object1.

--Troki

What is RxJS?

Your web site starts:

"RxJS a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators."

...Hm, sounds interesting I'll read more...

But next I need to know what you mean by observable sequences and LINQ then an example of how RxJS does the magic of the first sentence.

So by the second sentence I'm wondering if I will learn anything; the next paragraph gives the answer: no :-(. The next paragraph and the example that follows seems to be some kind of detail or at least not about the key idea of RxJS.

HTH....

Github or CodePlex the master?

I just noticed that there are more current commits to the Github repo than to the CodePlex repo. Which one is the center of activity (please say Github :) ?

Bug in delayWithSelector

When invoking delayWithSelector with a subscription delay, an exception is thrown for the following reason:

subscription.setDisposable(subDelay.subscribe(function () {
  start();
}, observer.onError.bind(onError), function () { start(); }));

should be

subscription.setDisposable(subDelay.subscribe(function () {
  start();
}, observer.onError.bind(observer.onError), function () { start(); }));

otherwise, the bind throws an exception, and the whole thing goes kaput.

Getting Started

I'm just trying to get started. I downloaded the project and tried one of the examples, autocomplete.html. It has errors "Error Rx is undefined". I open the html file and find references to "../lib/rx.js" but there is no lib folder in the project. I change this to "../../rx.js" but continue to get errors ("object does not support this property "fromevent"). I go to the root folder and try running build_core.bat but it complains that "grunt" is missing. I install node.js, then install grunt, build_core runs w/o errors, great! But still have no idea how to run the examples.

Add Events and Promises to Core

Given that ES6 is coming with Promises, and most libraries support them, should Promises be supported in the core such as:
https://gist.github.com/mattpodwysocki/6954807

We could have standard event support such as for Node.js and DOM as well:
https://gist.github.com/mattpodwysocki/6954620

Plus we could add a bridge support to have a fromEventPattern which would allow for any library to interact with standard events:
https://gist.github.com/mattpodwysocki/6954510

Which parts of these should be included?

Multiple observable onNext args.

Right now the onNext function seems to only pass one element into the observable sequence. Can/Should we be able to create sequences which provide multiple arguments upon subscription?

no more vsdoc files?

RxJs 2.0 had vsdoc files. I see that RxJs 2.2 doesn't seem to have them anymore. Have they been abandoned?

Any advice on how to get VS2012 to show meaningful intellisense when typing . for an Rx observable?

Split each operator into its own file for custom builds

In order to make custom builds easier, should we split each operator into its own file and then maintain a dependency chart so that we know what each operator depends on? This could dramatically alter the size of RxJS and give you only the operators you want/need. This falls much in line with what lo-dash has been doing very recently.

Merge fails on an array with Observables

Whereas in the old RxJS version you were able to do the follwing:

Rx.Observable.Merge([Rx.Observable.Return(3), Rx.Observable.Return(5)]).Subscribe(function(x){ console.log(x); });
//prints
3
5

With the new version this throws an error:

Rx.Observable.merge([Rx.Observable.returnValue(3), Rx.Observable.returnValue(5)]).subscribe(function(x){ console.log(x); });
//throws TypeError: Object [object Object],[object Object] has no method 'scheduleRecursive'

looking at the minified source (sigh) it seems to be failing at this point:

var ga = j.fromArray = function(a, b) {
        b || (b = D);
        return i(function(c) {
            var d = 
            0;
            //BOOOOM b seems to be an array here
            return b.scheduleRecursive(function(b) {
Uncaught TypeError: Object [object Object],[object Object] has no method 'scheduleRecursive'
                if (d < a.length)
                    c.onNext(a[d++]), b();
                else
                    c.onCompleted()
            })
        })

fromEvent() for node iffy

Before a recent refactor the fromEvent() method for node would generate an observable that would emit the arguments object as received by the internal handler. After a recent refactor the fromEvent() method for node only emits the first argument as received by the internal handler.

As a result, when attempting to generate an Observable from an http request event the Observable only emits the request parameter and leaves out the response parameter. The response object should not be dropped.

Rx.Observable.combineLatest

Before I get started, let me say that I am willing (wanting) to make the following changes, if such an idea is deemed worthy of approval.

I've been working extensively with RxJS lately, and found that Rx.Observable.prototype.combineLatest does not have a non-prototype counterpart, and does not accept an Array of sources as it's first parameter. For instance, the following exists:

1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });

Which is technically incorrect, and should be:

1 - obs = obs1.combineLatest(obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });

But I would propose expanding this to include:

// Rx.Observable.prototype
1 - obs = obs1.combineLatest(obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
2 - obs = obs1.combineLatest([obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
// Rx.Observable
1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });

Currently, the prototype method is the only method that exists, but I would suggest this method be refactored to move its implementation to a function not on the prototype. The prototype's functions would then invoke the non-prototype functions, in an effort to keep things dry.

Is this a good idea, and is there any hope of it reaching the RxJS code base?

npm installation

The documentation at https://github.com/Reactive-Extensions/RxJS says

npm install rxjs

but that apparently gets an ancient fork, namely

https://npmjs.org/package/rxjs

I think we should be doing

npm install rx

instead, getting

https://npmjs.org/package/rx

Consider including method for binding DOM events in core rx.js library?

Hi,
In the core rx.js library I don't think there is currently a way to bind to a dom event such as a button click e.g. something like:

function CreateObservable(element, eventType) {

return Rx.Observable.create(function(observer) {

    function eventHandler (eventObj) {
        observer.onNext(eventObj);              
    }

    //keep simple for example & ignore addEventListener/attachEvent browser differences
    element.addEventListener(eventType, eventHandler);

    return function() {
        element.removeEventListener(eventType, eventHandler);
    };
});

};

I am of two minds about this decision and I can see why you have separated this functionality out of the core library and that rx.js could be used for other non web page scenarios such as . node.

However it's a pain for new users getting started to have to create their own observable creation method or reference another script like rx.jquery.js to bind to simple events - either way I think the documentation can be improved on this aspect?

Almost real example of application with RxJS as a spine

There is very good trend - every js framework should prove it's power by submitting yet-another TODO app - http://todomvc.com

At the moment RxJS is not mentioned there. Also all examples I've met are a bit "artificial", they don't reveal the real power.

I was thinking about app that will use _.underscore (or loadash - mostly for templating and FP aspect) and require.js (for making tiny files/modules).

Should we start from creating subdir ./RxJS/TODO app?

Wrong `this`

This line:

https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/linq/observable.coincidence.js#L260

observableWindowWithOpenings(this, bufferOpeningsOrClosingSelector, bufferClosingSelector)

Should actually be:

observableWindowWithOpenings.call(this, bufferOpeningsOrClosingSelector, bufferClosingSelector)

Just like this line does: https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/linq/observable.coincidence.js#L278

Notice the call call. Otherwise, the this from here will be the global object:

https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/linq/observable.coincidence.js#L282

Rx.Observable.prototype.publishLast is missing

Hello,

Rx.Observable.prototype.publishLast is missing in NodeJS because two different Rx objects are used.

version": "2.1.2"

This code snippet can reproduce the issue:
$ node
> var Rx = require('rx');
> Rx.Observable.prototype.publishLast

in rx.node.js:1 it is ./rx.modern:

var Rx = require('./rx.modern');

in rx.binding.js:18 it is ./rx:

module.exports = factory(root, module.exports, require('./rx'));

Simplify the API

The API of RxJS looks a lot like a C# lib and in general a little verbose. So I want to suggest to talk about a simpler API design. Let me give some examples.

var source = Rx(target, 'mousemove');
Instead of
var source = Rx.Observable.fromEvent(target, 'mousemove');

var source = Rx($.getJSON('/products').promise());
Instead of
var source = Rx.Observable.fromPromise($.getJSON('/products').promise());

Add jQuery/Zepto shortcuts for event binding

Instead of insisting upon using Rx.Observable.fromEvent, should we shim for jQuery and Zepto to something like this?

var proto;
if ('Zepto' in window && Zepto.fn) {
    proto = Zepto.fn;
} else if ('jQuery' in window && jQuery.fn) {
    proto = jQuery.fn;
} else if ('angular' in window) {
    proto = angular.element.prototype; 
}
if (proto) {
    /** 
     * Takes the current selector and converts it into an observable sequence with the given event name.
     * @param {String} eventName The event name to bind to the observable sequence.
     * @returns {Observable} An observable sequence which wraps the existing event stream based upon selector
     */
    proto.asObservable = function (eventName) {
       return Rx.Observable.fromEvent(this, eventName);
    };
}

var $results = $('#results');

var subscription = $(document).asObservable('mousemove')
    .subscribe(function (e) {
        $results.text(e.clientX + ',' + e.clientY);
    });

A JSFiddle can be found here which should easily work if you switch between jQuery and Zepto.

Question. Should this be added to the core?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.