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

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

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

Powered by Google App Engine
This is Rietveld 408576698