I just want to implement
https://github.com/Reactive-Extensions/RxJS
into my node project.
Of course, there is an npm package available, but I see it as less updated, fewer modules and only uses min. files, so I want to use rxjs from git sources.
I downloaded RxJS-master and copied all the files under Dir to .. / myProject / lib / rx /
I see
rx.node.js among these 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 the following error:
.../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's wrong?
If I change rx.node.js to
var Rx = require('./rx'); module.exports = Rx;
The code works as expected, so obviously it is required - the auxiliary modules section is not suitable.
Thanks.
source share