setTimeout, setInterval, clearTimeout, clearInterval functions does not work with JavaScriptCore framework in iPhone #180

shahdhiren opened this Issue Jan 23, 2012 · 4 comments


None yet

3 participants

I have integrated Jasmine with iPhone project. I am running Jasmine using JavaScriptCore framework for iPhone. But JavaScriptCore is unable to interpret setTimeout and all that function.

I have statically defined those as below

this.setTimeout = function() {};
this.clearTimeout = function() {};
this.setInterval = function() {};
this.clearInterval = function() {};

I found that these functions are not part of JavaScriptCore. What could be solution to this...?? Is there any other alternative to these function??

usually you can do this way:

timeoutID = window.setTimeout(function(){}, 1000);
timeintervalID = window.setInterval(function(){}, 1000);

Thanks filipposarzana for your reply. But window is not defined in JavaScriptCore. so unable to get window object and hence the functions of it.. can you guide me some alternate way with JavaScriptCore..

thanks again...

infews commented Feb 11, 2012

Is the suggested fix that Jasmine not assume these functions are present? I believe we have to depend on setTimeout working in some situations.

infews commented May 27, 2013

Closing. At the moment supporing JavaScriptCore is not a priority.

However, we are now more careful about finding the global where the timing functions live. So this may be fixed on master

@infews infews closed this May 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment