setTimeout in Opera Mini 4.2?

G

Garrett Smith

I have read several sources stating that setTimeout is not implemented
in Opera Mini[1][2].

But for some odd reason, it is working for me.

Can someone clear up my confusion on this matter?

Using opera-mini-4.2.14912-advanced-en-us.jad, running on MicroEmulator.
The setTimeout function runs.

http://dhtmlkitchen.com/ape/adhoctest/setTimeout-test.html

Result in Opera Mini 4.2.14912:
Script says: Helloooooo! from setTimeout(fun 10), delay=12

[1]http://dev.a.com/articles/view/javascript-support-in-opera-mini-4/
[2]http://developer.yahoo.com/yui/yuitest/

I'm confused as to why others say it doesn't work, but it works for me.
Can anyone help clear up the confusion as to when it was implemented or
what I did to get a different result?
 
E

Eric Bednarz

Garrett Smith said:
Using opera-mini-4.2.14912-advanced-en-us.jad, running on
MicroEmulator. The setTimeout function runs.

http://dhtmlkitchen.com/ape/adhoctest/setTimeout-test.html

That is a *terrible* URI reference for mobile testing (at least if you
ask other people to do it for you ;-). Long, camelCase, hyphen, file
extension.
^
http://dev.opera.com/articles/view/javascript-support-in-opera-mini-4/

“[…] we don't allow scripts to run for more than a second or two once
the page has finished loading […]â€

Did you even consider to try a higher timeout value than 10
milliseconds? For me, the breaking point (Opera Mini on a mobile device
connecting via GPRS) is around 150 ms. Actually with exactly 150 ms the
function sometimes runs and sometimes doesn’t. Connecting via WLAN
slighly raises that value for me, but not much, and not consistently.
 
D

David Mark

That is a *terrible* URI reference for mobile testing (at least if you
ask other people to do it for you ;-). Long, camelCase, hyphen, file
extension.

And the test itself is awful too. Tests should be as simple and
direct as possible. The innerHTML property, implied globals, mutates
the DOM during load, type conversion of host methods, etc. Something
goes wrong here and it will be hard to blame setTimeout
exclusively. ;)

And why would a higher delay make it work if Opera Mini is cutting off
scripts after n seconds?
 
E

Eric Bednarz

And why would a higher delay make it work if Opera Mini is cutting off
scripts after n seconds?

But the point was that then it wouldn’t, as expected and – albeit
incompletely – documented on the Opera page Garrett mentioned). :)
 
D

David Mark

But the point was that then it wouldn’t, as expected and – albeit
incompletely – documented on the Opera page Garrett mentioned). :)

No, he mentioned a link that didn't work. What is dev.a.com supposed
to be?

I see where you corrected the link. It seems further indication of
the futility of the test.
 
G

Garrett Smith

Eric said:
Garrett Smith said:
Using opera-mini-4.2.14912-advanced-en-us.jad, running on
MicroEmulator. The setTimeout function runs.

http://dhtmlkitchen.com/ape/adhoctest/setTimeout-test.html

That is a *terrible* URI reference for mobile testing (at least if you
ask other people to do it for you ;-). Long, camelCase, hyphen, file
extension.
OK.
^
http://dev.opera.com/articles/view/javascript-support-in-opera-mini-4/

That's copy pasting at 1am.
“[…] we don't allow scripts to run for more than a second or two once
the page has finished loading […]â€

Did you even consider to try a higher timeout value than 10
milliseconds? For me, the breaking point (Opera Mini on a mobile device
connecting via GPRS) is around 150 ms. Actually with exactly 150 ms the
function sometimes runs and sometimes doesn’t. Connecting via WLAN
slighly raises that value for me, but not much, and not consistently.

I have not tried higher values, but will consider making tests for that.
Also worth testing are setInterval functions and setTimeout loops.

Thanks for the pointer.
 
D

Dr J R Stockton

D

David Mark

In comp.lang.javascript message <[email protected]
september.org>, Sat, 19 Sep 2009 12:26:56, Garrett Smith
<[email protected]> posted:




Try <URL:http://www.merlyn.demon.co.uk/js-dates.htm#Ress>,
<URL:http://www.merlyn.demon.co.uk/js-date0.htm#TaI>, on a PC and in
Mini.  It may well not answer your question; but it could be
interesting.

I suppose anything would be interesting in comparison. Still don't
see how the other "test" proves anything (certainly not that
window.setTimeout is defective in Opera Mini). Why test ridiculous
scenarios when reality is available?
 
E

Eric Bednarz

David Mark said:
[…] Still don't
see how the other "test" proves anything (certainly not that
window.setTimeout is defective in Opera Mini).

I’m getting the idea that you misunderstood something.

Garretts post/test was about setTimeout *working* in Opera mini,
something that can resonably be perceived as contradicting (amongst
other sources) Opera documentation.

However, the statement

| I have read several sources stating that setTimeout is not implemented
| in Opera Mini[1][2].

is not really substantiated by the Opera page. Something can be
implemented and not work, in particluar circumstances and for various
reasons. window.setTimeout in OPera mini appears to work with really
small timeout values.

[1] http://dev.opera.com/articles/view/javascript-support-in-opera-mini-4/
 
D

David Mark

David Mark said:
[…]  Still don't
see how the other "test" proves anything (certainly not that
window.setTimeout is defective in Opera Mini).

I’m getting the idea that you misunderstood something.

Yes, I had the same idea a few posts back.
Garretts post/test was about setTimeout *working* in Opera mini,
something that can resonably be perceived as contradicting (amongst
other sources) Opera documentation.

Yes. My mistake. Still a lousy test, but glad it managed to muddle
through. So your point is it may appear to work to a point, but watch
out if you raise the delay. Fair enough, but use another test for
that. A button that sets an input's value comes to mind.
However, the statement

| I have read several sources stating that setTimeout is not implemented
| in Opera Mini[1][2].

is not really substantiated by the Opera page. Something can be
implemented and not work, in particluar circumstances and for various
reasons. window.setTimeout in OPera mini appears to work with really
small timeout values.

Yes, I know setTimeout works in that browser. I don't know about
large timeout values though.
 
G

Garrett Smith

Eric said:
David Mark said:
[…] Still don't
see how the other "test" proves anything (certainly not that
window.setTimeout is defective in Opera Mini).

I’m getting the idea that you misunderstood something.

Garretts post/test was about setTimeout *working* in Opera mini,
something that can resonably be perceived as contradicting (amongst
other sources) Opera documentation.
Yep.

But I found that Opera Mini has undesirable results with
getBoundingClientRect in Mobile View:

http://my.opera.com/dhtmlkitchen/blog/
However, the statement

| I have read several sources stating that setTimeout is not implemented
| in Opera Mini[1][2].

is not really substantiated by the Opera page. Something can be
implemented and not work, in particluar circumstances and for various
reasons. window.setTimeout in OPera mini appears to work with really
small timeout values.

[1] http://dev.opera.com/articles/view/javascript-support-in-opera-mini-4/

That page states:
| No background scripts running after the page is loaded will be
| executed, and executing code using setTimeout is not possible.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top