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

Unified Diff: samples/calculator/calculator.dart

Issue 12259037: Reapply remove setTimeout, take 3. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | samples/dartcombat/setup.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/calculator/calculator.dart
diff --git a/samples/calculator/calculator.dart b/samples/calculator/calculator.dart
index 10a0477e9a567e954d619bf4ebb1bd7c750af2ed..cd6c2b4971373d8ff0b5d1808cb8784ae6af9f13 100644
--- a/samples/calculator/calculator.dart
+++ b/samples/calculator/calculator.dart
@@ -5,6 +5,7 @@
import 'dart:html';
import 'dart:math' as Math;
import 'calcui.dart';
+import 'dart:async';
Set numberKeyPresses;
Set operatorKeyPresses;
@@ -324,8 +325,9 @@ void flickerKey(Element key, [String postfix = '-hover']) {
}
key.classes.add('${theClass}${postfix}');
final String nextPostfix = (postfix == '-error') ? '-error' : '-press';
- window.setTimeout(() => resetKey(key, '${theClass}${postfix}',
- '${theClass}${nextPostfix}'), 80);
+ new Timer(const Duration(milliseconds: 80),
+ () => resetKey(key, '${theClass}${postfix}',
+ '${theClass}${nextPostfix}'));
}
void resetKey(Element key, String classToRemove, [String classToAdd = ""]) {
@@ -333,7 +335,8 @@ void resetKey(Element key, String classToRemove, [String classToAdd = ""]) {
key.classes.remove(classToRemove);
if (classToAdd.length > 0) {
key.classes.add(classToAdd);
- window.setTimeout(() => resetKey(key, classToAdd), 80);
+ new Timer(const Duration(milliseconds: 80),
+ () => resetKey(key, classToAdd));
}
}
}
« no previous file with comments | « no previous file | samples/dartcombat/setup.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698