Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: Release 8.3.1, Release 9.1.0
-
Fix Version/s: Release 9.0.3
-
Component/s: iOS
Description
There seem to be a critical regression regarding intervals in SDK 8 and 9 (so maybe caused between SDK 7 and 8?). See the following vanilla Node.js test case for reference (using a classic throttling mechanism):
let searchTimeout;
|
|
function search(value) { |
if (searchTimeout) { |
console.warn('Abort request'); |
clearTimeout(searchTimeout);
|
}
|
|
searchTimeout = setTimeout(() => {
|
console.warn('Start search: ' + value); |
}, 500);
|
}
|
|
function sleep(ms) { |
return new Promise(resolve => setTimeout(resolve, ms)); |
}
|
|
(async function () { |
search('m'); |
search('me'); |
search('mep'); |
}());
|
The expected console output is:
Abort request
|
Abort request
|
Start search: mep
|
But on iOS, the kroll timer manager has different plans with us:
Abort request
|
Start search: m
|
Start search: mep
|
Here is the app test case (wrapped into a quick i/o UI):
let searchTimeout;
|
|
function search(value) { |
if (searchTimeout) { |
console.warn('Abort request'); |
clearTimeout(searchTimeout);
|
}
|
|
searchTimeout = setTimeout(() => {
|
console.warn('Start search: ' + value); |
}, 500);
|
}
|
|
var win = Ti.UI.createWindow({ |
backgroundColor: '#fff' |
});
|
|
var btn = Ti.UI.createButton({ |
title: 'Test' |
});
|
|
btn.addEventListener('click', function onClick() { |
search('m') |
search('me') |
search('mep') |
});
|
|
win.add(btn);
|
win.open();
|
Notably, iOS does something wrong here. And Android works just fine (like Node.js).
Attachments
Issue Links
- relates to
-
TIMOB-28106 Ti.UI.Button: Titanium.UI.View Button TIMOB-27898 iOS only
-
- Open
-