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

fix: add conditional judgment when call update in the timer example. #2359 #2360

Merged
merged 1 commit into from May 19, 2023

Conversation

wangzhilongh
Copy link
Contributor

…, in the timer example. #2359

Description of Problem

Proposed Solution

Additional Information

@netlify
Copy link

netlify bot commented May 8, 2023

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit 811ee4f
🔍 Latest deploy log https://app.netlify.com/sites/vuejs/deploys/6458d4794b28860009274c0e
😎 Deploy Preview https://deploy-preview-2360--vuejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@NataliaTepluhina
Copy link
Member

@wangzhilongh could you please elaborate a little bit more on why this change is necessary?

@bencodezen bencodezen added the state: awaiting-feedback Needs more input before further actions can be taken label May 15, 2023
@wangzhilongh
Copy link
Contributor Author

@wangzhilongh could you please elaborate a little bit more on why this change is necessary?

1.When we open https://vuejs.org/examples/#timer , the 'update' method will be called very quickly. And it can not stop even if the elapsed time is bigger than the duration time. It just a waste of performance, but it doesn't make any sense.

image

So I think it is nessesary to stop call the 'update' method timely.

  1. In this case, the progress rate can easily be used to do some logical, or to control the details of the page. So I make a computed property 'progressRate' and it can be convenient for everyone to use.

As a way to solve this problem, I pull this request and hope it can be merged.
Of course, due to my limited ability, so the code may not be very appropriate. If you have any suggestions, welcome to exchange. And if you have a better solution, I am very happy to see and learn.

@NataliaTepluhina
Copy link
Member

@wangzhilongh thank you for the detailed explanation and especially for the screenshots provided! Now I see that update is being called after timer should have been finished indeed.

@NataliaTepluhina NataliaTepluhina merged commit 1a50977 into vuejs:main May 19, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: awaiting-feedback Needs more input before further actions can be taken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants