[AC-1766] clearTimeout throws exception
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Invalid |
| Resolution Date | 2012-11-28T19:35:28.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | n/a |
| Labels | n/a |
| Reporter | Remo |
| Assignee | Daniel Sefton |
| Created | 2012-11-28T19:14:17.000+0000 |
| Updated | 2016-03-08T07:40:39.000+0000 |
Description
Steps to Reproduce
var mainWindow = Ti.UI.createWindow();
var a = function() {
var b = 1 + 2;
};
setTimeout(a, 5000);
clearTimeout(a);
mainWindow.open();
Clear timeout throws an java.lang.NumberFormatException: invalid int: "org.mozilla.javascript.InterprededFunction@...." (...)
Actual Result
exceptionExpected Result
cleared timeoutAttachments
| File | Date | Size |
|---|---|---|
| .log | 2012-11-28T19:14:25.000+0000 | 276235 |
| diagnostic1306227832872066926.log | 2012-11-28T19:14:30.000+0000 | 1287 |
You're passing clearTimeout a function value, when it only accepts a Number value. It should be:
See the docs: http://docs.appcelerator.com/titanium/latest/#!/api/Global-method-clearTimeout Closing as invalid.var mainWindow = Ti.UI.createWindow(); var a = function() { var b = 1 + 2; }; var myTimeout = setTimeout(a, 5000); clearTimeout(myTimeout); mainWindow.open();