Skip to content

Instantly share code, notes, and snippets.

@novocaine
novocaine / TouchTimerWorkaround.js
Created December 6, 2012 05:00 — forked from jpattishall/TouchTimerWorkaround.js
setTimeout workaround for iPad and iOS6
/**
Workaround for iOS 6 setTimeout bug using requestAnimationFrame to simulate timers during Touch/Gesture-based events
Author: Jack Pattishall (jpattishall@gmail.com)
This code is free to use anywhere (MIT, etc.)
Usage: Pass TRUE as the final argument for setTimeout or setInterval.
Ex:
setTimeout(func, 1000) // uses native code
setTimeout(func, 1000, true) // uses workaround