Wondering what’s next for npm?Check out our public roadmap! »

    device-rotation
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.3 • Public • Published

    device-rotation

    Demo

    Install

    npm i device-rotation --save
    

    Usage

    import deviceRotation from 'device-rotation';
    
    const cb = function(position) {
        console.log(position.x, position.y);
    }
    
    if (DeviceRotation.isAvailable()) {
        deviceRotation.setCallback(cb);
        deviceRotation.start();
    }
    

    Request permission in iOS 13.

    It must be triggered on user action (click, tap or equivalent)

    let permissionButton = document.getElementById('permissionButton');
    
    if (DeviceRotation.isAvailable()) {
        if (DeviceRotation.needPermission()) {
            permissionButton.onclick = function () {
                DeviceRotation.start({ withPermission: true });
            }
        } else {
            DeviceRotation.start();
        }
    }
    

    Install

    npm i device-rotation

    DownloadsWeekly Downloads

    2

    Version

    1.0.3

    License

    ISC

    Unpacked Size

    7.6 kB

    Total Files

    5

    Last publish

    Collaborators

    • avatar