For instance,
does-not-work-how-i-had-expected.js
var Observable = require("rxjs/Observable").Observable;
console.log(Observable.of); // undefined
works-how-i-had-expected-1.js
var Observable = require("rxjs").Observable;
console.log(Observable.of); // [Function]
works-how-i-had-expected-2.js
var Observable = require("rxjs/Rx").Observable;
console.log(Observable.of); // [Function]
works-how-i-had-expected-3.js
var o = require("rxjs/Observable").Observable;
console.log(o.of); // undefined
require("rxjs");
console.log(o.of); // [Function] - The method gets mixed into `o`.
I am a little confused over all the different npm distributions of this; perhaps I should be experimenting with npm install @reactivex/rxjs instead?
When RxJS is released; what will be the package name for use with the latest node.js ?
Cheers :)
@kruncher the project is split into modules. when you require('rxjs'), you're importing the most common bits of the library. When you require('rxjs/Observable'), you're importing _just_ the Observable class without any operators.
Batteries-included modules exist (all, core, and DOM), but the operators are also individually exported to enable those whose projects are sensitive to file size. Individual operators can be imported and added to the Observable by importing them from the rxjs/add/ paths.
Observable.of is a part of the ES7 proposal (stage 1); I am surprised that it would be omitted from the bare-minimal Observable import.
I cannot see a rxjs/add/of import; but I guess it's hiding inside one of the options that are available.
I'll try and find out where it's hiding.
you can import add/fromArray to import of.
@kwonoj thanks :)
It's actually rxjs/add/observable/of now, I think.
Oh, you're correct. I missed that. :sweat_smile:
I'm closing this issue by module structure is explained and resolved.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
It's actually
rxjs/add/observable/ofnow, I think.