mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
use TKUnit wait
This commit is contained in:
@ -174,20 +174,12 @@ export function test_setInterval_callbackCalledWithExtraArgs(done) {
|
|||||||
export function test_setInterval_callbackNotDelayedByBusyWork() {
|
export function test_setInterval_callbackNotDelayedByBusyWork() {
|
||||||
let calls = 0;
|
let calls = 0;
|
||||||
|
|
||||||
function busyWait(ms: number) {
|
|
||||||
const waitStart = Date.now();
|
|
||||||
while (true) {
|
|
||||||
if (Date.now() - waitStart >= ms) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let firstCall = true;
|
let firstCall = true;
|
||||||
const id = timer.setInterval(() => {
|
const id = timer.setInterval(() => {
|
||||||
calls++;
|
calls++;
|
||||||
if (firstCall) {
|
if (firstCall) {
|
||||||
firstCall = false;
|
firstCall = false;
|
||||||
busyWait(25);
|
TKUnit.wait(0.025);
|
||||||
}
|
}
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user