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

Side by Side Diff: samples/third_party/todomvc_performance/web/lib-elements/simple_router.dart

Issue 1576153002: Remove the Dromaeo and TodoMVC samples. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
(Empty)
1 // Copyright 2013 The Polymer Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4 library todomvc.web.lib_elements.simple_router;
5
6 import 'dart:async';
7 import 'dart:html';
8 import 'package:polymer/polymer.dart';
9
10 // A very simple router for TodoMVC. Real app should use package:route, but it
11 // does not currently support Shadow DOM.
12 @CustomTag('simple-router')
13 class SimpleRouter extends PolymerElement {
14 @published String route = '';
15
16 StreamSubscription _sub;
17
18 factory SimpleRouter() => new Element.tag('simple-router');
19 SimpleRouter.created() : super.created();
20
21 attached() {
22 super.attached();
23 _sub = windowLocation.changes.listen((_) {
24 var hash = window.location.hash;
25 if (hash.startsWith('#/')) hash = hash.substring(2);
26 // TODO(jmesserly): empty string is not triggering a call to TodoList
27 // routeChanged after deployment. Use 'all' as a workaround.
28 if (hash == '') hash = 'all';
29 route = hash;
30 });
31 }
32
33 detached() {
34 super.detached();
35 _sub.cancel();
36 }
37
38 routeChanged() {
39 fire('route', detail: route);
40 }
41 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698