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

ios 15以下的版本,我开启一个setInterval 1000ms,在回调中log,发现,1s内log了很多次 #442

Open
Capyhw opened this issue Jan 9, 2025 · 4 comments

Comments

@Capyhw
Copy link

Capyhw commented Jan 9, 2025

No description provided.

@Capyhw Capyhw changed the title ios 15以下的版本,我开启一个setInterval 1000ms ios 15以下的版本,我开启一个setInterval 1000ms,在回调中log,发现,1s内log了很多次 Jan 9, 2025
@chrisguttandin
Copy link
Owner

Hi @Capyhw,

I had to translate your message with Google Translate. Just for reference, this is what I got back:

For iOS versions below 15, I started a setInterval of 1000ms, logged in the callback, and found that it was logged many times within 1 second.

I created a little demo which aims to reproduce the error. It logs the elapsed time in milliseconds between the calls to the callback. It should only log numbers of 1000 or higher.

https://stackblitz.com/edit/vitejs-vite-28dgeapc?file=src%2Fmain.js

Could you please check what it logs on your device?

@Capyhw
Copy link
Author

Capyhw commented Jan 10, 2025

Hi @Capyhw,

I had to translate your message with Google Translate. Just for reference, this is what I got back:

For iOS versions below 15, I started a setInterval of 1000ms, logged in the callback, and found that it was logged many times within 1 second.

I created a little demo which aims to reproduce the error. It logs the elapsed time in milliseconds between the calls to the callback. It should only log numbers of 1000 or higher.

https://stackblitz.com/edit/vitejs-vite-28dgeapc?file=src%2Fmain.js

Could you please check what it logs on your device?

image
image

@Capyhw
Copy link
Author

Capyhw commented Jan 10, 2025

Hi @Capyhw,

I had to translate your message with Google Translate. Just for reference, this is what I got back:

For iOS versions below 15, I started a setInterval of 1000ms, logged in the callback, and found that it was logged many times within 1 second.

I created a little demo which aims to reproduce the error. It logs the elapsed time in milliseconds between the calls to the callback. It should only log numbers of 1000 or higher.

https://stackblitz.com/edit/vitejs-vite-28dgeapc?file=src%2Fmain.js

Could you please check what it logs on your device?

image
ios12.5 上面是ua

@chrisguttandin
Copy link
Owner

Hi @Capyhw,

thanks for providing further feedback. Can you please check if performance.timeOrigin is available on the device. MDN says it became available in Safari v15. I suspect that if it's not available, everything falls apart.

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

No branches or pull requests

2 participants