Bug/Problem with setTimeout function

I know the title seems weird but hear me out.

  • I am using setTimeout() to keep track of some user events -like scroll ending-, which worked as expected (executed a function after a set time of milliseconds).
  • A few days ago I updated my device WebView to the latest version. Immediately after the function stopped working correctly.

Problem description:
setTimeout() always wait for about an extra second despite what ever time I set.

How to reproduce:
To clarify more here the same code I run on an app created by ionic cli (typescript)and another by cordova cli (javascript):

console.log('Timer Start');
let timeOutHandler = setTimeout(
    ()=>{
        console.log('Timer End');
    },
    100
);

Notes:

  • I tested the function in different parts/pages of the app.
  • I tested on 3 android devices with the same results.
  • The problem only appears in the latest WebView update (maybe slightly earlier updates too).
  • The tests where done in blank apps.
  • Of course the code above was written by JavaScript for the cordova app.

I am looking for any explanation on why and how does this happen? And if there is any workarounds?

Thank you.

As a final note, here is my ionic info (for the blank app):

cli packages:

    @ionic/cli-utils  : 1.6.0 (C:\Users\iaboelsuod\AppData\Roaming\npm\node_modules\ionic\node_modules\@ionic\cli-utils)
    ionic (Ionic CLI) : 3.6.0 (C:\Users\iaboelsuod\AppData\Roaming\npm\node_modules\ionic)

System:

    Android SDK Tools : 26.0.2
    Node              : v6.11.0
    OS                : Windows 10
    npm               : 3.10.10

I don’t think it’s related but I added just in case.