Created
June 2, 2013 20:59
-
-
Save harthur/5694953 to your computer and use it in GitHub Desktop.
Firefox scratchpad for simulating `deviceorientation` events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Run this in a Firefox "Scratchpad" (Tools > Web Developer > Scratchpad) | |
* With Cmd-R to simulate an orientation event in the current page | |
*/ | |
function simulateOrientation(alpha, beta, gamma) { | |
var event = document.createEvent("DeviceOrientationEvent"); | |
event.initDeviceOrientationEvent('deviceorientation', | |
true, true, alpha, beta, gamma, true); | |
window.dispatchEvent(event); | |
} | |
simulateOrientation(100, -30, 60); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment