Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: third_party/pkg/js/example/jsonp/jsonp.dart

Issue 180843004: Revert revision 33053 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/pkg/js/REVISION ('k') | third_party/pkg/js/example/jsonp/jsonp.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 library jsonp_sample;
2
3 import 'dart:html';
4
5 import 'package:js/js.dart';
6
7 const List<String> FIELDS = const ['name', 'description', 'size',
8 'watchers', 'forks'];
9
10 TableElement table = querySelector('#repo-table');
11
12 addTableHeadRow() {
13 var tr = new TableRowElement();
14 for (var field in FIELDS) {
15 tr.append(new Element.tag('th')..text = field);
16 }
17 table.querySelector('thead').append(tr);
18 }
19
20 addTableBodyRow(Proxy repo) {
21 var tr = new TableRowElement();
22 for (var field in FIELDS) {
23 var td = new TableCellElement();
24 if (field == 'name') {
25 td.append(new AnchorElement()
26 ..href = repo.html_url
27 ..text = repo[field]);
28 } else {
29 td.text = repo[field].toString();
30 }
31 tr.append(td);
32 }
33 table.querySelector('tbody').append(tr);
34 }
35
36 void main() {
37 // Create a jsObject to handle the response.
38 context.processData = (response) {
39 addTableHeadRow();
40 for (var i = 0; i < response.data.length; i++) {
41 addTableBodyRow(response.data[i]);
42 }
43 };
44
45 ScriptElement script = new Element.tag("script");
46 script.src = "https://api.github.com/users/dart-lang/repos?callback=processDat a";
47 document.body.children.add(script);
48 }
OLDNEW
« no previous file with comments | « third_party/pkg/js/REVISION ('k') | third_party/pkg/js/example/jsonp/jsonp.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698