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

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

Issue 23596007: Remove usage of dart:json. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase. Created 7 years, 3 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
OLDNEW
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 // A JS interop sample showing JSONP access to Twitter from Dart. 5 // A JS interop sample showing JSONP access to Twitter from Dart.
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 import 'dart:json';
9 import 'package:js/js.dart' as js; 8 import 'package:js/js.dart' as js;
10 9
11 void main() { 10 void main() {
12 // Create a JavaScript function called display that forwards to the Dart 11 // Create a JavaScript function called display that forwards to the Dart
13 // function. 12 // function.
14 js.context.display = new js.Callback.once(display); 13 js.context.display = new js.Callback.once(display);
15 14
16 // Inject a JSONP request to Twitter invoking the JavaScript display 15 // Inject a JSONP request to Twitter invoking the JavaScript display
17 // function. 16 // function.
18 document.body.nodes.add(new ScriptElement()..src = 17 document.body.nodes.add(new ScriptElement()..src =
(...skipping 25 matching lines...) Expand all
44 for (int i = 0; i < length; ++i) { 43 for (int i = 0; i < length; ++i) {
45 var result = results[i]; 44 var result = results[i];
46 String user = result.from_user_name; 45 String user = result.from_user_name;
47 String text = linkify(result.text); 46 String text = linkify(result.text);
48 47
49 var div = new DivElement() 48 var div = new DivElement()
50 ..innerHtml = '<div>From: $user</div><div>$text</div><p>'; 49 ..innerHtml = '<div>From: $user</div><div>$text</div><p>';
51 document.body.nodes.add(div); 50 document.body.nodes.add(div);
52 } 51 }
53 } 52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698