Skip to content

Instantly share code, notes, and snippets.

@harthur
Created June 2, 2013 20:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harthur/5694953 to your computer and use it in GitHub Desktop.
Save harthur/5694953 to your computer and use it in GitHub Desktop.
Firefox scratchpad for simulating `deviceorientation` events
/*
* 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