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

Side by Side Diff: samples/pop-pop-win/lib/src/html/high_score_view.dart

Issue 200723008: samples/poppopwin: upgrade to first-class sample (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 part of ppw_html; 1 part of ppw_html;
2 2
3 class HighScoreView { 3 class HighScoreView {
4 final DivElement _div; 4 final DivElement _div;
5 final GameManager _manager; 5 final GameManager _manager;
6 6
7 HighScoreView(this._manager, this._div) { 7 HighScoreView(this._manager, this._div) {
8 assert(_div != null); 8 assert(_div != null);
9 assert(_manager != null); 9 assert(_manager != null);
10 10
11 _manager.bestTimeUpdated.listen((args) => _update()); 11 _manager.bestTimeUpdated.listen((args) => _update());
12 12
13 _update(); 13 _update();
14 } 14 }
15 15
16 void _update() { 16 void _update() {
17 _manager.bestTimeMilliseconds 17 _manager.bestTimeMilliseconds
18 .then((int milliseconds) { 18 .then((int milliseconds) {
19 if(milliseconds != null) { 19 if(milliseconds != null) {
20 final duration = new Duration(seconds: milliseconds ~/ 1000); 20 final duration = new Duration(seconds: milliseconds ~/ 1000);
21 _div.innerHtml = duration.toString(); 21 _div.innerHtml = duration.toString();
22 } else { 22 } else {
23 _div.innerHtml = ''; 23 _div.innerHtml = '';
24 } 24 }
25 }); 25 });
26 } 26 }
27 } 27 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698