-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactored] _reactiveNextOperator and _reactiveMap to use named args
Summary: This is the first step towards #193. A nice side effect of this change in conjunction with D3392 is that the types on `transform` don't have to be manually specified - TypeScript can correctly infer them. It also makes calls to `reactiveMap` more readable, because the second argument is no longer an unnamed dictionary. As part of this change, the signature of the operation in `_reactiveNextOperator` is now a higher-order function. The root cause of D3383 was that there was no closure for an individual observer - state was either ephemeral for an individual emission or shared across all observers. By passing `emit` and `values` separately, there is now a scope where an operator can store observer-level state. In my next pass at #193, I will update `_nextOperator` to use this same signature. In fact, I wonder if `_nextOperator` and `_reactiveNextOperator` can be merged entirely. As an additional part of #193, I'm changing the name of `dispatch` to `emit` across the codebase. Something that has been emitted can naturally be called an emission. There's no good noun to refer to something that has been dispatched. I expect having an easy way to refer to each item in a stream will make documentation more clear. I typically abide by the one-small-change-per-diff policy, but since changing to named args is such a massive refactoring, it's a good time to make these smaller changes too. It reduces the number of refactoring passes over the codebase. Reviewers: O2 Material Motion, O3 Material JavaScript platform reviewers, #material_motion, featherless Reviewed By: O2 Material Motion, #material_motion, featherless Subscribers: featherless Tags: #material_motion Differential Revision: http://codereview.cc/D3395
- Loading branch information
1 parent
087f67e
commit 1d52a2e
Showing
17 changed files
with
200 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.