Skip to content

feat(bindCallback): rename fromCallback, add tests, and fix/refactor#881

Merged
benlesh merged 3 commits intoReactiveX:masterfrom
benlesh:bindCallback
Dec 4, 2015
Merged

feat(bindCallback): rename fromCallback, add tests, and fix/refactor#881
benlesh merged 3 commits intoReactiveX:masterfrom
benlesh:bindCallback

Conversation

@benlesh
Copy link
Copy Markdown
Member

@benlesh benlesh commented Dec 3, 2015

since fromCallback does not behave in a manner consistent with other fromX methods, it is being renamed to bindCallback as it returns a bound function that returns an observable

closes #876

@luisgabriel
Copy link
Copy Markdown
Contributor

👍

@kwonoj
Copy link
Copy Markdown
Member

kwonoj commented Dec 3, 2015

Cool 👍 :)

@benlesh
Copy link
Copy Markdown
Member Author

benlesh commented Dec 3, 2015

It looks like it doesn't quite work properly when scheduled, too, for some reason, so I'm going to try to fix that as well.

@benlesh
Copy link
Copy Markdown
Member Author

benlesh commented Dec 4, 2015

So I ended up rewriting this to use @mattpodwysocki's AsyncSubject (which might need a better name :p). This is because the observable returned has some shared state and is effectively multicast. That means that it either needs to maintain it's own list of internal subscribers, or it should use something like AsyncSubject. The former is almost definitely more performant, and we should probably move to that at some point. But the latter was convenient at this point in time.

@benlesh benlesh changed the title feat(bindCallback): rename fromCallback to bindCallback feat(bindCallback): rename fromCallback, add tests, and fix/refactor Dec 4, 2015
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Jasmine BDD style looks fairly similar to Mocha BDD. We could at some point try migrating from Jasmine to Mocha. At least we wouldn't need to rewrite/adapt every single test, it would be more a matter of fixing test-helper.js and the assertion tools for Mocha.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious if any other uses jasmine would experience similar before making decisions of migrating to another frameworks. + if mocha does have any known issues might need to consider (course earlier would be better since there are already more than > 1000 test cases, though effort wouldn't be huge still require some..)

@benlesh
Copy link
Copy Markdown
Member Author

benlesh commented Dec 4, 2015

It's probably something silly with Jasmine, we can leave this here for now, and since we have something that is reproducible (hopefully) we can PR Jasmine with a resolution.

@benlesh
Copy link
Copy Markdown
Member Author

benlesh commented Dec 4, 2015

So I'm going to merge this one in, but leave the weird jasmine test in that "jasmine is weird" file for now. Then if we can consistently reproduce that problem, I'll put an issue on Jasmine and try to help them resolve it. Also, those folks might be able to help us improve our test helpers or something. Perhaps that's the source of some of the weirdness.

@kwonoj
Copy link
Copy Markdown
Member

kwonoj commented Dec 4, 2015

I'll also try to triage jasmine issue once this is merged.

since fromCallback does not behave in a manner consistent with other fromX methods, it is being renamed to bindCallback as it returns a bound function that returns an observable

closes #876
thisArg is removed as this method does not mirror any native function with a thisArg

related #878
The previous implementation had issues with only calling the source function one time when scheduled. Since bindCallback shares its result with all subscribers, it is multicast, that means that it would need to maintain a list of subscribers internally. In leiu of that, I'm using AsyncSubject (which might need a better name)

closes #881
@benlesh benlesh merged commit 8637d47 into ReactiveX:master Dec 4, 2015
@benlesh benlesh deleted the bindCallback branch April 27, 2016 17:14
@lock
Copy link
Copy Markdown

lock Bot commented Jun 7, 2018

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.

@lock lock Bot locked as resolved and limited conversation to collaborators Jun 7, 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

Successfully merging this pull request may close these issues.

Rename fromCallback to bindCallback

4 participants