Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1766] clearTimeout throws exception

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionInvalid
Resolution Date2012-11-28T19:35:28.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterRemo
AssigneeDaniel Sefton
Created2012-11-28T19:14:17.000+0000
Updated2016-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

exception

Expected Result

cleared timeout

Attachments

FileDateSize
.log2012-11-28T19:14:25.000+0000276235
diagnostic1306227832872066926.log2012-11-28T19:14:30.000+00001287

Comments

  1. Daniel Sefton 2012-11-28

    You're passing clearTimeout a function value, when it only accepts a Number value. It should be:
       var mainWindow = Ti.UI.createWindow();
       
       var a = function() {
       	var b = 1 + 2;
       };
       var myTimeout = setTimeout(a, 5000);
       clearTimeout(myTimeout);
       
       mainWindow.open();
       
    See the docs: http://docs.appcelerator.com/titanium/latest/#!/api/Global-method-clearTimeout Closing as invalid.

JSON Source