How can I use the accelerometer in phaser 3?

Hello, I want to make a shoot em up in which the ship moves using the phone’s gyroscope, for this I use the Gyro.js library

This is the game code

var config = {
    type: Phaser.AUTO,
    scale:{mode: Phaser.Scale.ENVOLVED,},
    width: 800, height: 600,
    parent: 'container',
    scene: {
        preload: preload,
        create: create,
        update: update
    },
    physics:{default:"arcade"}
};
var bullets;
var ship;
var speed;
var stats;
var cursors;
var lastFired = 0;

var game = new Phaser.Game(config);

function preload (){
    this.load.image('ship', 'http://examples.phaser.io/assets/sprites/thrust_ship2.png');
    this.load.image('bullet', 'http://examples.phaser.io/assets/misc/bullet0.png');
    this.load.image('bg', 'http://examples.phaser.io/assets/skies/starfield.png')
}

function create (){
    
    this.add.image(400, 300, 'bg').setDisplaySize(800, 600);



    var Bullet = new Phaser.Class({

        Extends: Phaser.GameObjects.Image,

        initialize:

        function Bullet (scene){
            Phaser.GameObjects.Image.call(this, scene, 0, -4, 'bullet');

            this.speed = Phaser.Math.GetSpeed(300, 1);
        },

        fire: function (x, y){
            this.setPosition(x, y - 10);

            this.setActive(true);
            this.setVisible(true);
        },
        update: function (time, delta){
            this.y -= this.speed * delta;

            if (this.y < -25)
            {
                this.setActive(false);
                this.setVisible(false);
            }
        }

    });
    bullets = this.add.group({
        classType: Bullet,
        maxSize: 20,
        runChildUpdate: true
    });

    //  Create the objects in advance, so they're ready and waiting in the pool
    bullets.createMultiple({ quantity: 20, active: false });

    ship = this.physics.add.sprite(400, 580, 'ship').setDepth(1)
    .setCollideWorldBounds(true);

    cursors = this.input.keyboard.createCursorKeys();

    speed = Phaser.Math.GetSpeed(300, 1);

}
function update (time, delta){ 
    
    if (cursors.left.isDown){
        ship.x -= speed * delta;
    }
    else if (cursors.right.isDown){
        ship.x += speed * delta;
    }
    if (cursors.space.isDown && time > lastFired){

        var bullet = bullets.get();
        if (bullet){

            bullet.fire(ship.x, ship.y);
            lastFired = time + 50;
}
}}

This is the code of gyro.js

// setting gyroscope update frequency
gyro.frequency = 500;
// start gyroscope detection
gyro.startTracking((o)=>{g=o.gamma; document.write(g)})

the problem is that the value of gamma is null

image

How do I make gamma return the value of the gyroscope?

it is supposed to display a data of type double