
var Accelerometer = {
    start: function start(successCallback, errorCallback) {
        console.log('start watching accelerometer');
        function accelerationCallback(deviceMotionEvent) {
            successCallback(deviceMotionEvent.acceleration);
        }
        return document.addEventListener('devicemotion', accelerationCallback, false);
    },
    stop: function stop(watchId) {
        console.log('stop watching acecelerometer');
        document.removeEventListener('devicemotion', watchId);
    }
};

module.exports = Accelerometer;
require('cordova/firefoxos/commandProxy').add('Accelerometer', Accelerometer);


var Accelerometer = {
    start: function start(success, error) {
        return window.addEventListener('devicemotion', function(ev) {
            var acc = ev.accelerationIncludingGravity;
            acc.timestamp = new Date().getTime();
            success(ev.accelerationIncludingGravity);
        }, false);
    },

    stop: function stop() {
        window.removeEventListener('devicemotion');
    }
};

module.exports = Accelerometer;
require('cordova/firefoxos/commandProxy').add('Accelerometer', Accelerometer);

fix acceleromter for firefox os