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

Unified Diff: packages/js_util/lib/src/js_util_base.dart

Issue 2312183003: Removed Polymer from Observatory deps (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packages/js_util/lib/js_util.dart ('k') | packages/js_util/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/js_util/lib/src/js_util_base.dart
diff --git a/packages/js_util/lib/src/js_util_base.dart b/packages/js_util/lib/src/js_util_base.dart
deleted file mode 100644
index 7f35991c98c4c8d500bf9c9aedb2fdb764b9b082..0000000000000000000000000000000000000000
--- a/packages/js_util/lib/src/js_util_base.dart
+++ /dev/null
@@ -1,59 +0,0 @@
-@JS()
-library js_util.base;
-
-import 'package:js/js.dart';
-import 'package:quiver_iterables/iterables.dart';
-
-// js_util library uses the technique described in
-// https://github.com/dart-lang/sdk/issues/25053
-// because dart2js compiler does not support [] operator.
-
-@JS()
-@anonymous
-class PropertyDescription {
- external factory PropertyDescription(
- {bool configurable, bool enumerable, value, bool writable});
-}
-
-/// A wrapper for https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
-@JS('Object.defineProperty')
-external void defineProperty(o, String prop, PropertyDescription description);
-
-/// Returns `o[prop]`.
-@JS('JsUtil.getValue')
-external getValue(o, String prop);
-
-/// Creates a new JavaScript object.
-@JS('JsUtil.newObject')
-external newObject();
-
-/// Performs `o[key] = value`.
-void setValue(o, String key, value) {
- defineProperty(o, key, new PropertyDescription(value: value));
-}
-
-/// Converts a Dart object to a JavaScript object.
-///
-/// For example, you can convert a Dart [Map] to a JavaScript object.
-///
-/// final jsObj = toJS({
-/// 'people': [
-/// {'firstName': 'Kwang Yul', 'lastName': 'Seo'},
-/// {'firstName': 'DoHyung', 'lastName': 'Kim'},
-/// {'firstName': 'Kyusun', 'lastName': 'Kim'}
-/// ]
-/// });
-///
-toJS(o) {
- if (o is Map) {
- final newObj = newObject();
- for (final keyValuePair in zip([o.keys, o.values])) {
- setValue(newObj, keyValuePair[0], toJS(keyValuePair[1]));
- }
- return newObj;
- } else if (o is List) {
- return o.map((e) => toJS(e)).toList();
- } else {
- return o;
- }
-}
« no previous file with comments | « packages/js_util/lib/js_util.dart ('k') | packages/js_util/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698