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

Unified Diff: samples/pop_pop_win/web/platform_web.dart

Issue 242443008: samples/pop_pop_win: now based on StageXL (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: tiny nit Created 6 years, 8 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 | « samples/pop_pop_win/web/index.html ('k') | samples/pop_pop_win/web/resources/audio/audio.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/pop_pop_win/web/platform_web.dart
diff --git a/samples/pop_pop_win/web/platform_web.dart b/samples/pop_pop_win/web/platform_web.dart
index 2da4a5e0bf60b6348c4401b0050a864f73dab75d..9ea63174fd9a85bac6c2e97333b0ae4d32d07e92 100644
--- a/samples/pop_pop_win/web/platform_web.dart
+++ b/samples/pop_pop_win/web/platform_web.dart
@@ -5,12 +5,12 @@ import 'dart:html';
import 'package:pop_pop_win/platform_target.dart';
class PlatformWeb extends PlatformTarget {
- static const String _BIG_HASH = '#big';
static const String _ABOUT_HASH = '#about';
+ bool _sizeAccessed = false;
final StreamController _aboutController = new StreamController(sync: true);
- PlatformWeb(): super.base() {
+ PlatformWeb() : super.base() {
window.onPopState.listen((args) => _processUrlHash());
}
@@ -30,7 +30,12 @@ class PlatformWeb extends PlatformTarget {
Future<String> getValue(String key) =>
new Future.value(window.localStorage[key]);
- bool get renderBig => _urlHash == _BIG_HASH;
+ int get size {
+ _sizeAccessed = true;
+ var hash = (_urlHash == null) ? '7' : _urlHash;
+ hash = hash.replaceAll('#', '');
+ return int.parse(hash, onError: (e) => 7);
+ }
bool get showAbout => _urlHash == _ABOUT_HASH;
@@ -61,7 +66,6 @@ class PlatformWeb extends PlatformTarget {
var hash = loc.hash;
var href = loc.href;
- final History history = window.history;
switch (hash) {
case "#reset":
assert(href.endsWith(hash));
@@ -71,12 +75,14 @@ class PlatformWeb extends PlatformTarget {
loc.replace(newLoc);
break;
- case _BIG_HASH:
- if (!renderBig) loc.reload();
- break;
case _ABOUT_HASH:
_aboutController.add(null);
break;
+ default:
+ if (hash.isNotEmpty && _sizeAccessed) {
+ loc.reload();
+ }
+ break;
}
}
}
« no previous file with comments | « samples/pop_pop_win/web/index.html ('k') | samples/pop_pop_win/web/resources/audio/audio.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698