native_motion.js 409 Bytes
var Acceleration = function(x, y, z, timestamp) {
    this.x = x;
    this.y = y;
    this.z = z;
    this.timestamp = timestamp || (new Date()).getTime();
};

function native_motion_callbackWithInfo(result, onSuccess) {
    if (result["timestamp"]) {
        var c = new Acceleration(result["x"], result["y"], result["z"], result["timestamp"]);
        onSuccess(c);
    } else {
        onSuccess();
    }
}