8000 proper testcase for preserving 1st context fails by me-andre · Pull Request #64 · wuct/raf-throttle · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

proper testcase for preserving 1st context fails #64

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

me-andre
Copy link
Contributor
@me-andre me-andre commented Mar 31, 2019

If we make "preserves the context of the first call" testcase just slightly more complex, we clearly see it doesn't actually preserve the context of the 1st call as promised.
What it does is preserving the context of the 1st call after the last animation frame. When animation frames happen and how often is the last thing a developer wants to care about, so current behavior is close to unpredictable and thus unreliable.
I personally see 2 solutions to this problem:

  1. Make no assumptions regarding context (like lodash.throttle). This is the smartest choice.
  2. Treat context as an argument and invoke the callback with the most recent context (if we want those dances around context).

@me-andre me-andre mentioned this pull request Mar 31, 2019
@wuct
Copy link
Owner
wuct commented Mar 31, 2019

Thanks for opening this PR. Do you mind to implement the second behavior you mentioned in this PR as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0