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

Unified Diff: packages/js_util/example/js_util.dart

Issue 2119523002: Added full js & js_util packages (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packages/js_util/dist/js_util.min.js ('k') | packages/js_util/example/js_util.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/js_util/example/js_util.dart
diff --git a/packages/js_util/example/js_util.dart b/packages/js_util/example/js_util.dart
new file mode 100644
index 0000000000000000000000000000000000000000..ce87db131b9bb4b148bc80f98b909eeb5d04d815
--- /dev/null
+++ b/packages/js_util/example/js_util.dart
@@ -0,0 +1,20 @@
+import 'dart:html';
+
+import 'package:js_util/js_util.dart';
+
+void main() {
+ final jsObj = toJS({
+ 'people': [
+ {'firstName': 'Kwang Yul', 'lastName': 'Seo'},
+ {'firstName': 'DoHyung', 'lastName': 'Kim'},
+ {'firstName': 'Kyusun', 'lastName': 'Kim'}
+ ]
+ });
+
+ final people = getValue(jsObj, 'people');
+ final firstPerson = people[0];
+ final text =
+ '${getValue(firstPerson, "firstName")} ${getValue(firstPerson, "lastName")}';
+ document.querySelector('#container').innerHtml = text;
+}
+
« no previous file with comments | « packages/js_util/dist/js_util.min.js ('k') | packages/js_util/example/js_util.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698