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

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

Issue 1133733005: Use words please. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: also rename service rpc Created 5 years, 7 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library eval_box_element; 5 library eval_box_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'observatory_element.dart'; 9 import 'observatory_element.dart';
10 import 'package:polymer/polymer.dart'; 10 import 'package:polymer/polymer.dart';
(...skipping 10 matching lines...) Expand all
21 @published evalType callback; 21 @published evalType callback;
22 @observable ObservableList results = toObservable([]); 22 @observable ObservableList results = toObservable([]);
23 23
24 void updateLineMode(Event e, var detail, Node target) { 24 void updateLineMode(Event e, var detail, Node target) {
25 lineMode = (e.target as InputElement).value; 25 lineMode = (e.target as InputElement).value;
26 if (lineMode == '1-line') { 26 if (lineMode == '1-line') {
27 text = text.replaceAll('\n', ' '); 27 text = text.replaceAll('\n', ' ');
28 } 28 }
29 } 29 }
30 30
31 void eval(Event e, var detail, Node target) { 31 void evaluate(Event e, var detail, Node target) {
32 // Prevent any form action. 32 // Prevent any form action.
33 e.preventDefault(); 33 e.preventDefault();
34 34
35 // Clear the text box. 35 // Clear the text box.
36 var expr = text; 36 var expr = text;
37 text = ''; 37 text = '';
38 38
39 // Use provided callback to eval the expression. 39 // Use provided callback to eval the expression.
40 if (callback != null) { 40 if (callback != null) {
41 var map = toObservable({}); 41 var map = toObservable({});
42 map['expr'] = expr; 42 map['expr'] = expr;
43 results.insert(0, map); 43 results.insert(0, map);
44 callback(expr).then((result) { 44 callback(expr).then((result) {
45 map['value'] = result; 45 map['value'] = result;
46 }).catchError((e, st) { 46 }).catchError((e, st) {
47 map['error'] = e.message; 47 map['error'] = e.message;
48 app.handleException(e, st); 48 app.handleException(e, st);
49 }); 49 });
50 } 50 }
51 } 51 }
52 52
53 void selectExpr(MouseEvent e) { 53 void selectExpr(MouseEvent e) {
54 assert(e.target is Element); 54 assert(e.target is Element);
55 Element targetElement = e.target; 55 Element targetElement = e.target;
56 text = targetElement.getAttribute('expr'); 56 text = targetElement.getAttribute('expr');
57 } 57 }
58 58
59 EvalBoxElement.created() : super.created(); 59 EvalBoxElement.created() : super.created();
60 } 60 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/class_view.html ('k') | runtime/observatory/lib/src/elements/eval_box.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698