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

Unified Diff: src/site/docs/tutorials/indexeddb/examples/count_down/out/web/xmilestone.dart

Issue 26542002: edit pass on T3,4,5, updated images (Closed) Base URL: https://github.com/dart-lang/dartlang.org.git@master
Patch Set: merging with master Created 7 years, 2 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: src/site/docs/tutorials/indexeddb/examples/count_down/out/web/xmilestone.dart
diff --git a/src/site/docs/tutorials/indexeddb/examples/count_down/out/web/xmilestone.dart b/src/site/docs/tutorials/indexeddb/examples/count_down/out/web/xmilestone.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5a5593096e38b5be75e34d61084ed6e7baeac4bf
--- /dev/null
+++ b/src/site/docs/tutorials/indexeddb/examples/count_down/out/web/xmilestone.dart
@@ -0,0 +1,41 @@
+import 'package:polymer/polymer.dart';
+import 'milestone.dart';
+import 'count_down.dart';
+import 'dart:html';
+
+@CustomTag('x-milestone')
+class MilestoneComponent extends PolymerElement {
+ @observable Milestone get milestone => __$milestone; Milestone __$milestone; set milestone(Milestone value) { __$milestone = notifyPropertyChange(#milestone, __$milestone, value); }
+ @observable String _displayString = '';
+
+ // xx: Internationalize this.
+ //getters aren't automatically observed...so moved this method into the milestone object
+ //and observe that instead.
+ @observable String get timeRemainingAsString {
+ if (milestone.elapsed) {
+ _displayString = 'Huzzah for ${milestone.milestoneName}!';
+ return _displayString;
+ }
+
+ // Calculate days, hours, and minutes remaining.
+ Duration timeRemaining = milestone.timeRemaining;
+
+ int d = timeRemaining.inDays;
+ int h = timeRemaining.inHours.remainder(Duration.HOURS_PER_DAY);
+ int m = timeRemaining.inMinutes.remainder(Duration.MINUTES_PER_HOUR);
+ int s = timeRemaining.inSeconds.remainder(Duration.SECONDS_PER_MINUTE);
+
+ // Format individual pieces of the display string.
+ String days = (d == 0) ? '' : '$d days, ';
+ String hours = (h == 0) ? '' : '$h hours, ';
+ String minutes = (m == 0) ? '' : '$m minutes, ';
+ String seconds = '$s seconds';
+
+ _displayString = '$days $hours $minutes $seconds until ${milestone.milestoneName}';
+ return _displayString;
+ }
+
+ void removeMilestone(Event e, var detail, Node target) {
+ appObject.removeMilestone(milestone);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698