I have a Ionic1 App and I use an ion-timer on one view, below it on the same view is a ion-scroll element with a list of items.
Example Code:
<ion-content scroll="false">
<ion-timer class="timer" duration="duration" ispause="isPause" opts="ionTimerOpts""></ion-timer>
<ion-scroll>
//list content here...
</ion-scroll>
</ion-content>
The Timer gets refreshed with an $interval and counts down a variable.
On Android 7 Google changed the Webview to Chrome and with that I encountered a strange bug. When the user scrolls through the list, the timer freezes for a few seconds before it counts down again. This does not happen on every scroll but very often, so I guess it has something to do with system resource management. On older Android systems and on iOS this freeze does not occur.
So I'm looking for help to find a solution. I thought I may change the Timer to calculate the distance to a set timeStamp, in this way the timer stays correct in time, but the ui freeze would still be there, and that should not be the case.
EDIT:
It seems, that the chrome browser engine sets the priority of intervals very low, thats why intervals are not accurate enough for a timer, my solution was to change the timer code in a way that I simulate an interval with an recursive function that uses timeouts.
似乎chrome浏览器引擎将时间间隔的优先级设置得很低,这就是为什么时间间隔对于计时器而言不够准确,我的解决方案是更改计时器代码,方法是使用使用超时的递归函数模拟时间间隔。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.