| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #import('dart:html'); | 5 import 'dart:html'; |
| 6 #import('dart:json'); | 6 import 'dart:json'; |
| 7 | 7 |
| 8 /// Issue wraps JSON structure that describes a bug. | 8 /// Issue wraps JSON structure that describes a bug. |
| 9 class Issue { | 9 class Issue { |
| 10 final json; | 10 final json; |
| 11 Issue(this.json); | 11 Issue(this.json); |
| 12 | 12 |
| 13 void addTo(Element div) { | 13 void addTo(Element div) { |
| 14 div.elements.add(new Element.tag("h2")..text = json[r"title"][r"$t"]); | 14 div.elements.add(new Element.tag("h2")..text = json[r"title"][r"$t"]); |
| 15 div.elements.add(new Element.tag("pre")..text = json[r"content"][r"$t"]); | 15 div.elements.add(new Element.tag("pre")..text = json[r"content"][r"$t"]); |
| 16 } | 16 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 45 new HttpRequest.get(url, callback); | 45 new HttpRequest.get(url, callback); |
| 46 return c.future; | 46 return c.future; |
| 47 } | 47 } |
| 48 | 48 |
| 49 void main() { | 49 void main() { |
| 50 // Requests new issues from the Dart issue database as json. | 50 // Requests new issues from the Dart issue database as json. |
| 51 const String url = "https://code.google.com/feeds/issues/p/dart/issues/full"; | 51 const String url = "https://code.google.com/feeds/issues/p/dart/issues/full"; |
| 52 const String options = "alt=json&can=new"; | 52 const String options = "alt=json&can=new"; |
| 53 requestJson("$url?$options").then(processJson); | 53 requestJson("$url?$options").then(processJson); |
| 54 } | 54 } |
| OLD | NEW |