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
from
Open

feat: use queueMicrotask for nextTick timerFunc #10865

wants to merge 2 commits into from

Conversation

@HOUCe
Copy link

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

This comment has been minimized.

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 left a comment

LGTM except that dist files shouldn't be included.

@HOUCe

This comment has been minimized.

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 Dec 6, 2019
Copy link
Member

Justineo left a comment

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
Projects
None yet
2 participants
You can’t perform that action at this time.