Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export all operators and observables from index file #1646

Closed
mrtnbroder opened this issue Apr 25, 2016 · 7 comments
Closed

Export all operators and observables from index file #1646

mrtnbroder opened this issue Apr 25, 2016 · 7 comments

Comments

@mrtnbroder
Copy link

mrtnbroder commented Apr 25, 2016

When using the es next function bind method of importing operators, it's kind of tedious to write it all one line after each other, like this:

import { debounceTime } from 'rxjs/operator/debounceTime'
import { map } from 'rxjs/operator/map'
import { repeat } from 'rxjs/operator/repeat'
import { scan } from 'rxjs/operator/scan'
import { takeUntil } from 'rxjs/operator/takeUntil'

it would be great to have an index file that exports all operators so we can import our operators like this:

import { debounceTime, map, repeat, scan, takeUntil } from 'rxjs/operator'

same thing for observable(s)

@mrtnbroder mrtnbroder changed the title Export all operators from index file Export all operators and observables from index file Apr 29, 2016
@ghost
Copy link

ghost commented Jun 20, 2016

I think this issue is related to #1386

@benlesh
Copy link
Member

benlesh commented Feb 21, 2017

@staltz @trxcllnt you both 👍 'ed this.. does this have some bundling/modularity/tree-shaking benefit I'm not aware of? It seems like it would be bad for bundling to use this because it would include a whole mess of modules you probably don't want to use. However, it might work with tree-shaking? I don't know.

@trxcllnt
Copy link
Member

trxcllnt commented Mar 2, 2017

@benlesh from what I understand, webpack etc. should be able to tree-shake ES6 exports/imports done this way. Worth testing to make sure though.

@david-driscoll
Copy link
Member

It would be great if those operators were "lodash" like, in that the first argument is the observable, so you don't have to do weird ways of calling them.

map.call(filter.call(of('a'), x => !!x), x => x * 2);

vs

map(filter(of('a'), x => !!x), x => x * 2);

This way we wouldn't have to wait for a new version to change them later.

@mattpodwysocki
Copy link
Collaborator

@david-driscoll that's exactly what I'm doing for IxJS so that we don't have that silly .call behavior https://github.com/reactivex/ixjs

@imgx64
Copy link

imgx64 commented Jan 8, 2018

Is this bug fixed by Lettable Operators? From that page:

import { map, filter, scan } from 'rxjs/operators';

@kwonoj
Copy link
Member

kwonoj commented Sep 26, 2018

I think it's no longer an issue with export organization changes in v6.

@kwonoj kwonoj closed this as completed Sep 26, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Oct 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants