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

Side by Side Diff: samples/calculator/tape.dart

Issue 12218131: Combine window.setTimeout/setInterval with Timer and Timer.repeating. Also (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of calcui; 5 part of calcui;
6 6
7 class Tape { 7 class Tape {
8 static const int OP_NOOP = 0; 8 static const int OP_NOOP = 0;
9 static const int OP_PLUS = 1; 9 static const int OP_PLUS = 1;
10 static const int OP_MINUS = 2; 10 static const int OP_MINUS = 2;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 tapeUI.tape.children.add(element.children[0]); 182 tapeUI.tape.children.add(element.children[0]);
183 183
184 scrollToTapeBottom(); 184 scrollToTapeBottom();
185 185
186 currentOperator = null; 186 currentOperator = null;
187 currentRegister = ""; 187 currentRegister = "";
188 total = 0.0; 188 total = 0.0;
189 } 189 }
190 190
191 void scrollToTapeBottom() { 191 void scrollToTapeBottom() {
192 window.setImmediate(() { 192 window.immediate.then((_) {
193 // theTape.rect.scroll.top = rect.scroll.height; 193 // theTape.rect.scroll.top = rect.scroll.height;
194 // TODO(terry): Would like to set scrollTop of tape doesn't seem to work 194 // TODO(terry): Would like to set scrollTop of tape doesn't seem to work
195 // so I scroll by max lines. 195 // so I scroll by max lines.
196 tapeUI.tape.scrollByLines(100000); 196 tapeUI.tape.scrollByLines(100000);
197 }); 197 });
198 } 198 }
199 199
200 void removeActiveElements() { 200 void removeActiveElements() {
201 final element = new Element.tag('div'); 201 final element = new Element.tag('div');
202 202
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 DivElement get activeInput => window.document.query("#activeInput"); 237 DivElement get activeInput => window.document.query("#activeInput");
238 DivElement get activeTotal => window.document.query("#activeTotal"); 238 DivElement get activeTotal => window.document.query("#activeTotal");
239 239
240 void clear() { 240 void clear() {
241 final element = new Element.tag('div'); 241 final element = new Element.tag('div');
242 element.innerHtml = tapeUI.clearCalculation(); 242 element.innerHtml = tapeUI.clearCalculation();
243 tapeUI.tape.children.add(element.children[0]); 243 tapeUI.tape.children.add(element.children[0]);
244 } 244 }
245 } 245 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698