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

Side by Side Diff: dart/site/try/src/ui.dart

Issue 340343006: Send console messages through interaction manager. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add comments. Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dart/site/try/src/interaction_manager.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 trydart.ui; 5 library trydart.ui;
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 8
9 import 'dart:async' show 9 import 'dart:async' show
10 Future, 10 Future,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 Map<String, Function> codeCallbacks = new Map<String, Function>(); 87 Map<String, Function> codeCallbacks = new Map<String, Function>();
88 88
89 void onCodeChange(Event event) { 89 void onCodeChange(Event event) {
90 SelectElement select = event.target; 90 SelectElement select = event.target;
91 String id = select.querySelectorAll('option')[select.selectedIndex].id; 91 String id = select.querySelectorAll('option')[select.selectedIndex].id;
92 Function action = codeCallbacks[id]; 92 Function action = codeCallbacks[id];
93 if (action != null) action(event); 93 if (action != null) action(event);
94 outputFrame.style.display = 'none'; 94 outputFrame.style.display = 'none';
95 outputDiv.nodes.clear();
95 } 96 }
96 97
97 buildUI() { 98 buildUI() {
98 interaction = new InteractionManager(); 99 interaction = new InteractionManager();
99 100
100 CompilationUnit.onChanged.listen(interaction.onCompilationUnitChanged); 101 CompilationUnit.onChanged.listen(interaction.onCompilationUnitChanged);
101 102
102 window.localStorage['currentSample'] = '$currentSample'; 103 window.localStorage['currentSample'] = '$currentSample';
103 104
104 buildCode(interaction); 105 buildCode(interaction);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 192
192 tryColumn.append(inputWrapper); 193 tryColumn.append(inputWrapper);
193 outputFrame.style.display = 'none'; 194 outputFrame.style.display = 'none';
194 runColumn.append(outputFrame); 195 runColumn.append(outputFrame);
195 runColumn.append(outputWrapper); 196 runColumn.append(outputWrapper);
196 runColumn.append(hackDiv); 197 runColumn.append(hackDiv);
197 198
198 var settingsElement = document.getElementById('settings'); 199 var settingsElement = document.getElementById('settings');
199 settingsElement.onClick.listen(openSettings); 200 settingsElement.onClick.listen(openSettings);
200 201
201 window.onMessage.listen(interaction.onMessage); 202 window.onMessage.listen(interaction.onWindowMessage);
202 203
203 observer = new MutationObserver(interaction.onMutation) 204 observer = new MutationObserver(interaction.onMutation)
204 ..observe( 205 ..observe(
205 mainEditorPane, childList: true, characterData: true, subtree: true); 206 mainEditorPane, childList: true, characterData: true, subtree: true);
206 207
207 scheduleMicrotask(() { 208 scheduleMicrotask(() {
208 mainEditorPane.appendText(currentSource); 209 mainEditorPane.appendText(currentSource);
209 }); 210 });
210 211
211 // You cannot install event handlers on window.applicationCache 212 // You cannot install event handlers on window.applicationCache
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 window.localStorage['compilationPaused'] = '$compilationPaused'; 467 window.localStorage['compilationPaused'] = '$compilationPaused';
467 window.localStorage['codeFont'] = '$codeFont'; 468 window.localStorage['codeFont'] = '$codeFont';
468 469
469 dialog.style.height = '0px'; 470 dialog.style.height = '0px';
470 } 471 }
471 form.onSubmit.listen(onSubmit); 472 form.onSubmit.listen(onSubmit);
472 473
473 var doneButton = document.getElementById('settings-done'); 474 var doneButton = document.getElementById('settings-done');
474 doneButton.onClick.listen(onSubmit); 475 doneButton.onClick.listen(onSubmit);
475 } 476 }
OLDNEW
« no previous file with comments | « dart/site/try/src/interaction_manager.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698