首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >类JsObject没有构造函数jsify

类JsObject没有构造函数jsify
EN

Stack Overflow用户
提问于 2013-12-03 23:37:18
回答 1查看 275关注 0票数 1

我正在尝试使用Dart执行一个map示例。但是我得到了一个错误,类JsObject没有构造函数jsify,我使用的dart代码是

代码语言:javascript
复制
library google_maps;

import 'dart:html' show query;
import 'dart:js' show context, JsObject;

void main() {
  // The top-level getter context provides a JsObject that represents the global
  // object in JavaScript.
  final google_maps = context['google']['maps'];

  // new JsObject() constructs a new JavaScript object and returns a proxy
  // to it.
  var center = new JsObject(google_maps['LatLng'], [-34.397, 150.644]);

  var mapTypeId = google_maps['MapTypeId']['ROADMAP'];

  // new JsObject.jsify() recursively converts a collection of Dart objects
  // to a collection of JavaScript objects and returns a proxy to it.
  var mapOptions = new JsObject.jsify({
      "center": center,
      "zoom": 8,
      "mapTypeId": mapTypeId
  });

  // Nodes are passed though, or transferred, not proxied.
  new JsObject(google_maps['Map'], [query('#map-canvas'), mapOptions]);
}

pubspec.yaml是

代码语言:javascript
复制
name: google_maps_api_with_dart_js
description: An app that displays a location using the JavaScript
    Google Maps API that is called using the dart:js library.
dependencies:
  browser: ">=0.9.0 <0.10.0"
environment:
  sdk: ">=0.8.10+6 <2.0.0"
EN

回答 1

Stack Overflow用户

发布于 2013-12-05 20:57:36

我通过切换到新版本解决了这个问题

Dart编辑器版本1.0.0_r30188 (稳定) Dart SDK版本1.0.0.3_r30188

现在一切都正常了。

谢谢!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20355335

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档