start: function()

in src/windows/AccelerometerProxy.js [32:57]


    start: function (win, lose) {
        var accel = Windows.Devices.Sensors.Accelerometer.getDefault();
        if (!accel) {
            if (lose) {
                lose('No accelerometer found');
            }
        } else {
            accel.reportInterval = Math.max(16, accel.minimumReportInterval);

            // store our bound function
            this.onDataChanged = function (e) {
                var a = e.reading;
                win(new Acceleration(a.accelerationX * gConstant, a.accelerationY * gConstant, a.accelerationZ * gConstant), {
                    keepCallback: true
                });
            };
            accel.addEventListener('readingchanged', this.onDataChanged);

            setTimeout(function () {
                var a = accel.getCurrentReading();
                win(new Acceleration(a.accelerationX * gConstant, a.accelerationY * gConstant, a.accelerationZ * gConstant), {
                    keepCallback: true
                });
            }, 0); // async do later
        }
    },