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

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

Issue 200723008: samples/poppopwin: upgrade to first-class sample (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fixed pkgbuild.status for rename 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 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/texture_data.dart » ('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/third_party/pop-pop-win/web/platform_web.dart b/samples/pop_pop_win/web/platform_web.dart
similarity index 72%
rename from samples/third_party/pop-pop-win/web/platform_web.dart
rename to samples/pop_pop_win/web/platform_web.dart
index 721066d2a74f79996d85f4ab498eed606f6cb401..9725da7fbd0903b905068673b6dd854274d95c5c 100644
--- a/samples/third_party/pop-pop-win/web/platform_web.dart
+++ b/samples/pop_pop_win/web/platform_web.dart
@@ -2,7 +2,6 @@ library ppw_platform_web;
import 'dart:async';
import 'dart:html';
-import 'dart:js' as js;
import 'package:poppopwin/platform_target.dart';
class PlatformWeb extends PlatformTarget {
@@ -31,22 +30,6 @@ class PlatformWeb extends PlatformTarget {
Future<String> getValue(String key) =>
new Future.value(window.localStorage[key]);
- @override
- void trackAnalyticsEvent(String category, String action, [String label,
- int value]) {
- var args = ['send', 'event', category, action];
- if(label != null) {
- args.add(label);
- }
-
- if(value != null) {
- assert(label != null);
- args.add(value);
- }
-
- js.context.callMethod('ga', args);
- }
-
bool get renderBig => _urlHash == _BIG_HASH;
bool get showAbout => _urlHash == _ABOUT_HASH;
@@ -54,11 +37,11 @@ class PlatformWeb extends PlatformTarget {
Stream get aboutChanged => _aboutController.stream;
void toggleAbout([bool value]) {
- final Location loc = window.location;
+ var loc = window.location;
// ensure we treat empty hash like '#', which makes comparison easy later
- final hash = loc.hash.length == 0 ? '#' : loc.hash;
+ var hash = loc.hash.length == 0 ? '#' : loc.hash;
- final isOpen = hash == _ABOUT_HASH;
+ var isOpen = hash == _ABOUT_HASH;
if(value == null) {
// then toggle the current value
value = !isOpen;
@@ -74,9 +57,9 @@ class PlatformWeb extends PlatformTarget {
String get _urlHash => window.location.hash;
void _processUrlHash() {
- final Location loc = window.location;
- final hash = loc.hash;
- final href = loc.href;
+ var loc = window.location;
+ var hash = loc.hash;
+ var href = loc.href;
final History history = window.history;
switch(hash) {
@@ -89,7 +72,7 @@ class PlatformWeb extends PlatformTarget {
loc.replace(newLoc);
break;
case _BIG_HASH:
- loc.reload();
+ if (!renderBig) loc.reload();
break;
case _ABOUT_HASH:
_aboutController.add(null);
« no previous file with comments | « samples/pop_pop_win/web/index.html ('k') | samples/pop_pop_win/web/texture_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698