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

feat: use queueMicrotask for nextTick timerFunc #10865

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

Conversation

HOUCe
Copy link

@HOUCe HOUCe commented Nov 26, 2019

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

Hey guys, thanks for reviewing this.

I've added queueMicrotask for nextTick timerFunc.

Reason to do this:

  • queueMicrotask() method is the standard way to introduce a microtask safely and without tricks.
  • Why it has the priority than Promise?
    By introducing queueMicrotask(), the quirks that arise when sneaking in using promises to create microtasks can be avoided. For instance, when using promises to create microtasks, exceptions thrown by the callback are reported as rejected promises rather than being reported as standard exceptions. Also, creating and destroying promises takes additional overhead both in terms of time and memory that a function which properly enqueues microtasks avoids.

I think there is no need to create a unit test, current tests will cover this small change well. I also mocked UI experiment for test queueMicrotask() on real terminal, no bizarre behaviors found so far (as it is the standard way).

@HOUCe
Copy link
Author

HOUCe commented Dec 3, 2019

Cloud someone give some attention to this little PR?

@yyx990803
@posva
@eddyerburgh
@Justineo

Copy link
Member

@Justineo Justineo left a comment

Choose a reason for hiding this comment

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

LGTM except that dist files shouldn't be included.

@HOUCe
Copy link
Author

HOUCe commented Dec 5, 2019

LGTM except that dist files shouldn't be included.

@Justineo

Sure, dist files is clear now.
I will let you guys to decide the next. Anyway is a tiny change (:

Thanks for the time.

@HOUCe HOUCe requested a review from Justineo December 6, 2019 02:38
Copy link
Member

@Justineo Justineo left a comment

Choose a reason for hiding this comment

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

I've already approved this earlier...@HOUCe

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