How to use cordova-plugin-device-orientation - 8 common examples

To help you get started, we’ve selected a few cordova-plugin-device-orientation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github blefebvre / aem-phonegap-kitchen-sink / content-dev / src / main / content / jcr_root / content / phonegap / kitchen-sink / shell / _jcr_content / pge-app / app-content / phonegap / plugins / cordova-plugin-device-orientation / src / tizen / CompassProxy.js View on Github external
compassCallback = function (orientation) {
                var heading = 360 - orientation.alpha;

                if (compassReady) {
                    if (successCallback)
                        successCallback( new CompassHeading (heading, heading, 0, 0));
                    window.removeEventListener("deviceorientation", compassCallback, true);
                }
                compassReady = true;
            };
            compassReady = false; // workaround invalid first event value returned by WRT
            window.addEventListener("deviceorientation", compassCallback, true);
        }
        else {
            if (errorCallback)
                errorCallback(CompassError.COMPASS_NOT_SUPPORTED);
        }
    },
github apache / cordova-plugin-device-orientation / src / tizen / CompassProxy.js View on Github external
compassCallback = function (orientation) {
                var heading = 360 - orientation.alpha;

                if (compassReady) {
                    if (successCallback)
                        successCallback( new CompassHeading (heading, heading, 0, 0));
                    window.removeEventListener("deviceorientation", compassCallback, true);
                }
                compassReady = true;
            };
            compassReady = false; // workaround invalid first event value returned by WRT
            window.addEventListener("deviceorientation", compassCallback, true);
        }
        else {
            if (errorCallback)
                errorCallback(CompassError.COMPASS_NOT_SUPPORTED);
        }
    },
github blefebvre / aem-phonegap-kitchen-sink / content-dev / src / main / content / jcr_root / content / phonegap / kitchen-sink / shell / _jcr_content / pge-app / app-content / phonegap / plugins / cordova-plugin-device-orientation / src / tizen / CompassProxy.js View on Github external
compassCallback = function (orientation) {
                var heading = 360 - orientation.alpha;

                if (compassReady) {
                    if (successCallback)
                        successCallback( new CompassHeading (heading, heading, 0, 0));
                    window.removeEventListener("deviceorientation", compassCallback, true);
                }
                compassReady = true;
            };
            compassReady = false; // workaround invalid first event value returned by WRT
github apache / cordova-plugin-device-orientation / src / tizen / CompassProxy.js View on Github external
compassCallback = function (orientation) {
                var heading = 360 - orientation.alpha;

                if (compassReady) {
                    if (successCallback)
                        successCallback( new CompassHeading (heading, heading, 0, 0));
                    window.removeEventListener("deviceorientation", compassCallback, true);
                }
                compassReady = true;
            };
            compassReady = false; // workaround invalid first event value returned by WRT
github apache / cordova-plugin-device-orientation / src / windows / CompassProxy.js View on Github external
setTimeout(function () {
                lose(CompassError.COMPASS_NOT_SUPPORTED);
            }, 0);
        } else {
github apache / cordova-plugin-device-orientation / src / windows / CompassProxy.js View on Github external
getHeading: function (win, lose) {
        var deviceCompass = Windows.Devices.Sensors.Compass.getDefault();
        if (!deviceCompass) {
            setTimeout(function () {
                lose(CompassError.COMPASS_NOT_SUPPORTED);
            }, 0);
        } else {
            var reading = deviceCompass.getCurrentReading(),
                heading = new CompassHeading(reading.headingMagneticNorth, reading.headingTrueNorth, null, reading.timestamp.getTime());
            setTimeout(function () {
                win(heading);
            }, 0);
        }
    },
    stopHeading: function (win, lose) {
github blefebvre / aem-phonegap-kitchen-sink / content-dev / src / main / content / jcr_root / content / phonegap / kitchen-sink / shell / _jcr_content / pge-app / app-content / phonegap / plugins / cordova-plugin-device-orientation / src / windows / CompassProxy.js View on Github external
getHeading: function (win, lose) {
        var deviceCompass = Windows.Devices.Sensors.Compass.getDefault();
        if (!deviceCompass) {
            setTimeout(function () {
                lose(CompassError.COMPASS_NOT_SUPPORTED);
            }, 0);
        } else {
            var reading = deviceCompass.getCurrentReading(),
                heading = new CompassHeading(reading.headingMagneticNorth, reading.headingTrueNorth, null, reading.timestamp.getTime());
            setTimeout(function () {
                win(heading);
            }, 0);
        }
    },
    stopHeading: function (win, lose) {

cordova-plugin-device-orientation

Cordova Device Orientation Plugin

Apache-2.0
Latest version published 6 months ago

Package Health Score

68 / 100
Full package analysis