reactive-extensions / rxjs-jquery Goto Github PK
View Code? Open in Web Editor NEWReactive Extensions bindings for jQuery
Home Page: http://reactive-extensions.github.com/rxjs-jquery
Reactive Extensions bindings for jQuery
Home Page: http://reactive-extensions.github.com/rxjs-jquery
$(document)
.readyAsObservable()
.flatMap(function(obj) {
return $.ajaxAsObservable({
url: 'cityList',
dataType: 'jsonp'
});
})
.flatMapLatest(function(res) {
return res.list; // is Arrary
})
.reduce(function(acc, x, idx, source) {
alert(acc); //has data
return acc + '<div></div>';
}, '')
.subscribe(function(x) {
alert(x); //Does not perform
}, function(err) {
alert(err); //Does not perform
},
function() {
alert('Completed'); //Does not perform
});
Is it intentional that toObservable has gone? Can we just add it as an alias for bindAsObservable(). This looks really verbose to my eyes.
I tried to use rxjs-jquery to implement the auto-complete example, but I receive the error
Uncaught TypeError: Object #<AnonymousObservable> has no method 'publish'
when calling keyupAsObservable()
on the text input that I selected using JQuery.
Here's a JS Fiddle that reproduces the problem for me in Chrome and Safari (open the web inspector / console to see the error): http://jsfiddle.net/JoshRosen/z93hB/1/
Am I using incompatible versions of rxjs, rxjs-jquery, or jquery, or is this a bug?
When I use bower and browserify and run karma, browserify complain that cannot resolve rxjs-jquery dependency. It looks like there is a bug in a commonjs packaging for bower.
Here is the error which I'm getting:
rscheibinger@rscheibinger-Precision-T5600:~/code/hackweek/ebay-ui-text-input-widget$ karma start karma.conf.js
INFO [karma]: Karma v0.12.28 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 39.0.2171 (Linux)]: Connected on socket 4WtE0D5OBm8TfLrs07Zz with id 8946935
ERROR [framework.browserify]: bundle error
ERROR [framework.browserify]: Error: Cannot find module 'rx' from '/home/rscheibinger/code/hackweek/ebay-ui-text-input-widget/bower_components/rxjs-jquery'
Chrome 39.0.2171 (Linux) ERROR
TEST RUN WAS CANCELLED because this file contains some errors:
/tmp/06ce568170248657aa57dcd3d75bce509482bd15.browserify
I work on Linux machine.
Tried this on IE 10 and the latest Chrome but value.data.length is returning as undefined. Value.data does contain two items. index 0 is the search text and index 1 is the results.
Hi. rxjs-jquery does not work with latest RxJS 5 I reckon.
It tries to refer Rx.Disposable.empty
and gets Cannot read property 'empty' of undefined cause it's been replaced with Rx.Subscription. Expect to see more errors. Version 5 brought some major API changes.
Please consider providing proper rxjs dependency version. Looking forward to heaving your lib working with rx ver 5.
Best regards
Looking at the source of rx.jquery.js there is intention of passing the jQuery object through the observable when it triggers, but there is some mismanagement of 'this' causing it to be the DOM element passed through and not the intended and expected jQuery object.
handeAnimation (note the misspelling) should be passing jQueryProto to the subject.onNext call, and not 'this'
proto.animateAsObservable should capture 'this' to a local and that local passed to the subject.onNext call inside the complete callback.
proto.fadeToAsObservable should do the same thing as above
the dragndrop demo fails after every 2 times drag. and I don't know why.
can anybody have a try?
https://github.com/Reactive-Extensions/rxjs-jquery/blob/master/examples/draganddrop/dragndrop.js
Do these methods leak handlers when a DOM element is destroyed? I see that they return disposables, so the observer can unsubscribe. But I don't see a way for the observable to complete the stream when the DOM element is destroyed.
This causes issues with require.js, as it doesn't allow multiple qualifiers to point to a single file. Changing it fixes the issue. Thanks!
Should I add other HTML5 capabilities to RxJS-jQuery such as Geolocation, Subjects, Web Workers, etc like I have in RxJS-DOM?
Is there a usage example for Deferred.toObservable? rxjs-jquery attempts to modify the prototype for
$.Deferred.prototype.toObservable.call(deferred)
but I doubt that this is the expected usage.
Perhaps the prototype extension works with particular versions of jquery. Is there a list of supported jquery versions?
I found two versions on npm: rx-jquery and rxjs-jquery. Both lead to a crash!
npm install rx-jquery
Call require('rx-jquery')
results in:
.../node_modules/rx-jquery/rx.jquery.js:84
} if (!!proto.on) {
^
TypeError: Cannot read property 'on' of undefined
at .../node_modules/rx-jquery/rx.jquery.js:84:19
at observable (.../node_modules/rx-jquery/rx.jquery.js:13:26)
at Object.<anonymous> (.../node_modules/rx-jquery/rx.jquery.js:17:2)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (.../node_modules/rx-jquery/rx.jquery.node.js:2:1)
npm install rxjs-jquery
Call require('rxjs-jquery')
results in:
.../node_modules/rxjs-jquery/rx.jquery.js:22
observable = root.Observable,
^
TypeError: Cannot read property 'Observable' of undefined
at .../node_modules/rxjs-jquery/rx.jquery.js:22:26
at $ (.../node_modules/rxjs-jquery/rx.jquery.js:13:26)
at Object.<anonymous> (.../node_modules/rxjs-jquery/rx.jquery.js:17:2)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (.../tmp.js:3:11)
Installing the newest version through bower fails for 1.1.1 with "Package rx not found". It works fine for 1.0.1.
I think the dependency package name should be rxjs, but bower info rxjs-jquery
shows:
dependencies: {
rx: '*'
}
Hi, great work here, but the examples not working correctly, I try to use the "AutoComplete.html" sample.
First, is a error in a url.. Find by "http//" in html document.
Second, is a error in execution, I don't know if is a version of Rx, but the error is here:
"function observableCreateRefCount(subscribe) {
return observableCreate(subscribe).publish().refCount();
}"
The object does not support property or method "publish".
Samples are used to motivate new developers..
It wraps the $.ajax in an AsyncSubject but inmediatly starts executing it.
Code like this does not work correctly:
var o = $("#some-element").onAsObservable("click");
o.subscribe(handler).dispose();
o.subscribe(handler); // <-- event handler gets registered incorrectly
The cause is the args.push(handler)
call that happens on every subscription and thus starts accumulating junk that messes up the call to the jQuery method.
args
needs to get reset back to a clean copy of arguments
on each subscription.
As #26 say, I am interested in RxJS and think it meets my company's needs, but I do not know how to use it.
Please please please add some documentation to the Wiki, examples would be nice too.
Thanks ;-)
I saw the wiki got filled with spam. Probably not what you wanted to happen.
$(...).bind('eventType', function (ev, a, b) { })
.trigger('eventType', [ 'val1', 'val2' ]);
will pass 'val1' and 'val2' as the 2nd and 3rd argument to the event handler. bindAsObservable()
(and other "AsObservable" versions) only captures the event object. Could these methods be changed to add the additional arguments as a property on the event object? Something like this in the handler: eventObject.additionalArguments = arguments.slice(1);
I'm trying to use rxjs-jquery
with requirejs
. When you load jQuery
via requirejs
, it defines its module id as jquery
. However, rxjs-jquery
defines its dependency as jQuery
. This can be worked around by adding to the require
config, but it seems like it would be cleaner if rxjs-jquery
just used the correctly cased module id (jquery
) instead.
Thanks
According to the README there should be a keypressAsObservable
shortcut available but it doesn't work and I couldn't find it in the included js file.
when i try
"bower install rx-jquery" i get the error message:
"bower ENOTFOUND Package rx-jquery not found"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.