question

hellokevinpas avatar image
hellokevinpas asked

window.requestAnimationFrame is throwing an exception

I just "moved" this from the "Fire Tablets" forum. I'm working on my fourth webapp ( see list here: http://kevinpas.github.io/ ). In this new app I'm using window.requestAnimationFrame() instead of window.setInterval(). I'm using a pretty new Amazon Web App Tester. If I run the app in the web app tester I'm having the following problem: window.requestAnimationFrame() is throwing an exception in both a lg smart phone and a Samsung tablet. When I use window.setInterval() everything works fine on these and in ie 11 or ff 28. (Using window.requestAnimationFrame() or window.setInterval(), works fine in ie 11, and firefox 28.) Best practices says to use requestAnimationFrame() : https://developer.amazon.com/appsandservices/solutions/platforms/webapps/docs/best-practices.html If I use "window.requestAnimationFrame( params)" I get: window.requestAnimationFrame() --> TypeError: Object [ object DOMWindow ] has no method 'requestAnimationFrame' If I use "requestAnimationFrame( params )" I get ReferenceError: requestAnimationFrame is not defined. Does anyone know why this is happening?
web apps
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Nick Gardner avatar image
Nick Gardner answered
According to http://caniuse.com/#search=requestAnimationFrame, it appears that requestAnimationFrame isn't supported on all but the latest versions of a lot of browsers and webviews, so it may be that you'd need to use another option as a fallback measure if requestAnimationFrame isn't available.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

hellokevinpas avatar image
hellokevinpas answered
Thanks, For some reason I was under the impression that Amazon packed up the web apps in Amazons own renderer / browser and then the whole package (browser included) got downloaded when the user purchases the app.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.