I simply want to implement
https://github.com/Reactive-Extensions/RxJS
to my node project.
Surely, there is the npm-package available, but I see it less updated, less modules, and uses only min. files, so I want to use rxjs from git sources.
I downloaded RxJS-master and copy the whole files under the Dir to ../myProject/lib/rx/
I see
rx.node.js among those files
var Rx = require('./rx');
require('./rx.aggregates');
require('./rx.binding');
require('./rx.coincidence');
require('./rx.experimental');
require('./rx.joinpatterns');
require('./rx.testing');
require('./rx.time');
module.exports = Rx;
so, my app.js code is like this
var rx = require("./lib/rx/rx.node.js")
function test()
{
var as = new rx.AsyncSubject()
setTimeout(function ()
{
as.onNext("works!")
as.onCompleted()
}, 500)
return as
}
var a = test().subscribe(function (result)
{
console.log("Got result: " + result)
})
This gives an error as follows,
.../rx/lib/rx/rx.binding.js:173
var BehaviorSubject = Rx.BehaviorSubject = (function (_super) {
^
ReferenceError: Rx is not defined
at .../rx/lib/rx/rx.binding.js:173:27
at Observable (.../rx/lib/rx/rx.binding.js:14:26)
at Object.<anonymous> (.../rx/lib/rx/rx.binding.js:18:2)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (.../rx/lib/rx/rx.node.js:3:1)
Process finished with exit code 1
What is wrong?
If I modify rx.node.js to
var Rx = require('./rx');
module.exports = Rx;
The code works as expected, so obviously require - sub modules section does not go well.
Thanks.
Fixed as of the latest build and I removed the bad build in question with this commit
NPM has been updated accordingly to remove 2.1.1 and replaced with a non-broken version.