-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat(Observable): initially create Observable.generate factory #1537
Conversation
@@ -20,6 +20,7 @@ import './add/observable/fromArray'; | |||
import './add/observable/fromEvent'; | |||
import './add/observable/fromEventPattern'; | |||
import './add/observable/fromPromise'; | |||
import './add/observable/generate'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this is going under Rx
, it may need to be also under kitchenSink
as well. (kitchSink
contains all of Rx
export)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know what should be included into kitchenSink
. I'll include.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kwonoj kitchen sink imports all of Rx by default, so if it is part of rx, kitchen sink will see it too.
https://github.com/ReactiveX/rxjs/blob/master/src/Rx.KitchenSink.ts#L2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I missed that. Sorry for bringing confusion.
@Igorbek this PR needs to be flattened and rebased. |
Sure. |
cfeafea
to
32b7cf8
Compare
const expected = '(12345|)'; | ||
|
||
expectObservable(source).toBe(expected); | ||
});*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to enable this test need to fix #1543 first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've checked in #1544 prior to this and believe this is now unblocked - would you mind to update this one?
@Blesh, it's been flattened and rebased. |
Sure, no problem. |
cce6b1f
to
894c721
Compare
Ok, now it's been fixed, flattened and rebased again. |
Sorry for reviewing this late in the process, and thank you for the effort so far. I'd like to remind about the criteria for merging an operator (this was shown as a PR comment template when a PR is opened), so there are still a few things missing until this operator is "complete", namely:
If you need a reference in how to do those, I recommend looking at
|
Ok, I've just returned from Build and so now will probably have more time this week to complete this journey. |
@@ -120,6 +120,7 @@ There are operators for different purposes, and they may be categorized as: crea | |||
- [`fromEvent`](../class/es6/Observable.js~Observable.html#static-method-fromEvent) | |||
- [`fromEventPattern`](../class/es6/Observable.js~Observable.html#static-method-fromEventPattern) | |||
- [`fromPromise`](../class/es6/Observable.js~Observable.html#static-method-fromPromise) | |||
- `generate` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@staltz should I make it a link by following the pattern around?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, a link is nice 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Ok, looks like I'm done. That's what was changed:
@staltz please review and see my question about doc link |
const source = Observable.generate(1, x => x == 1, x => x + 1); | ||
const expected = '(1|)'; | ||
|
||
expectObservable(source).toBe(expected, { '1': 1 }); | ||
}); | ||
it('should produce all values synchronously', () => { | ||
|
||
asDiagram('generate(1, x => x < 3, x => x + 1)') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually we have only one of these asDiagram
tests, per file. This third one is the most interesting for a diagram. Can you make the 1st and 2nd test revert back to normal it()
test?
@staltz Please go ahead with your separate PR for the docs. I've slightly changed the docs, so I hope it'll help you. The informal part and long technical description are still missing. I appreciate your assistance. |
Nice, thanks |
@staltz ... this looks okay from my review, but I'm leaving it up to you since it seems like you're waiting for something docs related. |
Okay.. this LGTM. Last thing would be to flatten this into one commit. @Igorbek can you flatten this? The commit message should be something like I'm publishing in a few minutes, so this will probably land in next week's release. |
- add overloads that accepts distinct options and a single options object - add tests with marble diagrams - add JSDoc
2fe2115
to
e4c9f56
Compare
Done. |
LGTM, thanks Igor |
@Blesh just curious, why don't you use normal merge and use this strange cherry picking? |
@Igorbek I think it's because of https://github.com/ReactiveX/rxjs/blob/master/doc/maintainer-guidelines.md |
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. |
Description:
The PR adds static
Observable.generate/GenerateObservable.create
method with implementation aligned with RxJS4.The signature supports passing parameters and a single options:
Related issue:
#1482
This is my first PR here, hi everybody :)