为什么在添加侦听器时出现错误?

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    function onSuccess(position) {
        this.latitude = position.coords.latitude;
        this.longitude = position.coords.longitude;
        this.speed = position.coords.speed;
        console.log(this.speed);
        document.getElementById("updater").innerHTML = ' ' + this.speed +" m/s"
    }
    function onError(error) {
        alert('code: '    + error.code    + '\n' +
              'message: ' + error.message + '\n');
    }
    var watchID = navigator.geolocation.watchPosition(this.onSuccess, this.onError, { maximumAge: 3000, timeout: 5000, enableHighAccuracy: true });
}

@Component({
    selector: 'app-home',
    templateUrl: 'home.page.html',
    styleUrls: ['home.page.scss'],
})
export class HomePage {
    framework = 'At exact boarding time';

    constructor(private pickerCtrl:PickerController, 
        private geolocation: Geolocation) {}

    async showPicker() {
        let opts: PickerOptions ={
            buttons: [
                {
                    text:'Done'
                }

            ],

            columns: [
                {
                    name: 'framework',
                    options: [
                        {text:'10 minutes before boarding time',value:0},
                        {text:'5 minutes before boarding time',value:1},
                        {text:'At exact boarding time',value:2},
                        {text:'5 minutes after boarding time',value:3},
                        {text:'10 minutes after boarding time',value:4}
                    ],
                    selectedIndex: 2,
                }
            ]
        }
        let picker = await this.pickerCtrl.create(opts);
        picker.present();
        picker.onDidDismiss().then(async data=>{
            let col = await picker.getColumn('framework');
            this.framework=col.options[col.selectedIndex].text
        })
    }
}

因此,在顶部,我放置了侦听器,该侦听器应在启动应用程序时激活以下函数“ onDeviceReady()”。现在,我正在尝试更新html元素。

元素未更新,但是我是否正确处理此问题?我是打字稿新手。