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; |
+} |
+ |