Skip to content

Instantly share code, notes, and snippets.

View jpreece6's full-sized avatar

Josh Preece jpreece6

  • UK
View GitHub Profile
@jpreece6
jpreece6 / shake.js
Last active August 29, 2015 13:58 — forked from leecrossley/shake.js
Shake.js edited for better error handling. Using a shake.error() function which can be overridden with an external function.
var shake = (function () {
var shake = {},
watchId = null,
options = { frequency: 300 },
previousAcceleration = { x: null, y: null, z: null },
shakeCallBack = null;
// Start watching the accelerometer for a shake gesture
shake.startWatch = function (onShake) {
if (onShake) {