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

Unified Diff: samples/swarm/swarm_ui_lib/view/ConveyorView.dart

Issue 12258020: Reverting setTimeout removal. (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
Index: samples/swarm/swarm_ui_lib/view/ConveyorView.dart
diff --git a/samples/swarm/swarm_ui_lib/view/ConveyorView.dart b/samples/swarm/swarm_ui_lib/view/ConveyorView.dart
index 87c0710af71221fba597e13611af7e1ce532a88f..696c1bd4d74c3ad3c843f3c33b93e31e9bbedcad 100644
--- a/samples/swarm/swarm_ui_lib/view/ConveyorView.dart
+++ b/samples/swarm/swarm_ui_lib/view/ConveyorView.dart
@@ -23,11 +23,11 @@ class ConveyorView extends CompositeView {
// which view is selected? (e.g. the MVVM pattern)
Function viewSelected;
- Timer animationTimer;
+ int animationTimeoutId;
ConveyorView()
: super('conveyor-view', true),
- animationTimer = null {
+ animationTimeoutId = null {
}
Element render() {
@@ -61,10 +61,13 @@ class ConveyorView extends CompositeView {
final xTranslationPercent = -index * 100;
style.transform = 'translate3d(${xTranslationPercent}%, 0px, 0px)';
+ if (animationTimeoutId != null) {
+ window.clearTimeout(animationTimeoutId);
+ }
+
if (animate) {
- animationTimer = new Timer(
- new Duration(milliseconds: ((durationSeconds * 1000).toInt())),
- () { _onAnimationEnd(); });
+ animationTimeoutId = window.setTimeout(
+ () { _onAnimationEnd(); }, (durationSeconds * 1000).toInt());
}
// TODO(mattsh), we should set the visibility to hide everything but the
// selected view.
« no previous file with comments | « samples/swarm/swarm_ui_lib/touch/Scrollbar.dart ('k') | samples/tests/samples/dartcombat/dartcombat_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698