| Index: third_party/pkg/js/example/jsonp/jsonp.dart
|
| diff --git a/samples/jsonp/web/index.dart b/third_party/pkg/js/example/jsonp/jsonp.dart
|
| similarity index 70%
|
| copy from samples/jsonp/web/index.dart
|
| copy to third_party/pkg/js/example/jsonp/jsonp.dart
|
| index bbcedac86e47d965edaa930e5f36fadb307b25ad..1b5371e390600b7feb1f8be6c14f22a10bef561e 100644
|
| --- a/samples/jsonp/web/index.dart
|
| +++ b/third_party/pkg/js/example/jsonp/jsonp.dart
|
| @@ -1,11 +1,8 @@
|
| -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
| -// for details. All rights reserved. Use of this source code is governed by a
|
| -// BSD-style license that can be found in the LICENSE file.
|
| -
|
| library jsonp_sample;
|
|
|
| import 'dart:html';
|
| -import 'dart:js';
|
| +
|
| +import 'package:js/js.dart';
|
|
|
| const List<String> FIELDS = const ['name', 'description', 'size',
|
| 'watchers', 'forks'];
|
| @@ -20,13 +17,13 @@ addTableHeadRow() {
|
| table.querySelector('thead').append(tr);
|
| }
|
|
|
| -addTableBodyRow(JsObject repo) {
|
| +addTableBodyRow(Proxy repo) {
|
| var tr = new TableRowElement();
|
| for (var field in FIELDS) {
|
| var td = new TableCellElement();
|
| if (field == 'name') {
|
| td.append(new AnchorElement()
|
| - ..href = repo['html_url']
|
| + ..href = repo.html_url
|
| ..text = repo[field]);
|
| } else {
|
| td.text = repo[field].toString();
|
| @@ -38,10 +35,10 @@ addTableBodyRow(JsObject repo) {
|
|
|
| void main() {
|
| // Create a jsObject to handle the response.
|
| - context['processData'] = (response) {
|
| + context.processData = (response) {
|
| addTableHeadRow();
|
| - for (var repo in response['data']) {
|
| - addTableBodyRow(repo);
|
| + for (var i = 0; i < response.data.length; i++) {
|
| + addTableBodyRow(response.data[i]);
|
| }
|
| };
|
|
|
|
|