在Firefox中使用Dart进行地理定位getCurrentPosition不是函数 [英] Geolocation with Dart in Firefox getCurrentPosition not a function

查看:340
本文介绍了在Firefox中使用Dart进行地理定位getCurrentPosition不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Dart中编写了这段代码

I have written this code in Dart

window.navigator.geolocation.getCurrentPosition((Geoposition position) {
    window.alert(position.coords.latitude.toString());
});

当我在Dantium或Google Chrome中运行它时,它运行正常,但如果我尝试在Firefox ,我收到此JavaScript错误

When I run it in Dantium or Google Chrome it works fine, but if I try running this in Firefox, I get this JavaScript error

Timestamp: 15/11/12 21:36:19
Error: TypeError: getCurrentPosition$1 is not a function

这是wierd,这使用html5 JavaScript

This is wierd as if I just wrote this using html5 JavaScript

if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(showPosition);
}

function showPosition(position) {
    var latlon=position.coords.latitude+","+position.coords.longitude;
    alert(latlon);
}

在Firefox中可以正常工作。

It works perfectly fine in Firefox.

Firefox版本是16.0.2,Dart编辑器版本是0.2.3_r14669,Dart SDK版本是0.2.3.0_r14669。

The Firefox version is 16.0.2, Dart Editor version is 0.2.3_r14669 and Dart SDK version is 0.2.3.0_r14669.

这是错误还是我做错了?

Is this a bug or am I doing something wrong?

编辑:

这是一个错误 http://code.google.com/p/dart/issues/detail?id=6733&q=getCurrentPosition&colspec=ID%20Type%20Status

It was a bug http://code.google.com/p/dart/issues/detail?id=6733&q=getCurrentPosition&colspec=ID%20Type%20Status%20Priority%20Area%20Milestone%20Owner%20Summary, but it is marked as fixed now, by @Pete Blois shown below.

推荐答案

问题已修复,以及导致其无法在IE10上运行的问题。

Issue has been fixed, as well as an issue causing it to not work on IE10.

这篇关于在Firefox中使用Dart进行地理定位getCurrentPosition不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆