HTML5 navigator.geolocation in Web Workers

后端 未结 4 466
温柔的废话
温柔的废话 2020-12-07 01:47

I am trying to move my code for navigator.geolocation in a web worker.

I tried it with Chrome and Safari but getting \'undefined\' on

var isGPSSupported =

4条回答
  •  -上瘾入骨i
    2020-12-07 02:22

    Inspecting it in chrome, it appears it definitely doesn't have the geolocation attribute:

    WorkerNavigator
    appName: "Netscape"
    appVersion: "5.0 (Windows NT 6.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1"
    onLine: true
    platform: "Win32"
    userAgent: "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.1 (KHTML, like Gecko)  Chrome/22.0.1207.1 Safari/537.1"
    __proto__: WorkerNavigator
    

    In Chrome, you can set a breakpoint in your workers. I'd recommend doing this for your errors, its extremely helpful.

提交回复
热议问题