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

Side by Side Diff: runtime/observatory/lib/src/elements/shims/binding.dart

Issue 2310003004: Removed polymer & mirror from Observatory (Closed)
Patch Set: Fixed crash in heap-map page 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
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.
4
5 import 'dart:core';
6 import 'dart:html';
7 import 'dart:js';
8 @MirrorsUsed(metaTargets: const [BindableAnnotation])
9 import 'dart:mirrors';
10 import 'package:js/js.dart';
11 import 'package:js_util/js_util.dart';
12 import 'package:polymer/polymer.dart';
13
14 const BindableAnnotation bindable = const BindableAnnotation();
15 class BindableAnnotation {
16 const BindableAnnotation();
17 }
18
19
20 ///This is a temporary bridge between Polymer Bindings and the wrapper entities.
21 class Binder<T extends HtmlElement> {
22 final Map<String, Symbol> attributes;
23
24 const Binder(Map<String, Symbol> attributes)
25 : attributes = attributes;
26
27 registerCallback(T element) {
28 assert(element != null);
29 setValue(element, 'bind', allowInteropCaptureThis(_callback));
30 }
31
32 void _callback(_this, name, value, [other]) {
33 final setter = attributes[name];
34 if (setter == null) return;
35 Bindable bindable;
36 if (identical(1, 1.0)) { // dart2js
37 bindable = getValue(getValue(value, '__dartBindable'), 'o') as Bindable;
38 } else { // vm
39 bindable = getValue(value, '__dartBindable');
40 }
41 var obj = reflect(_this);
42 obj.setField(setter, bindable.value);
43 bindable.open((value) {
44 obj.setField(setter, value);
45 });
46 }
47 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/service_ref.html ('k') | runtime/observatory/lib/src/elements/source_inset.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698