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

Side by Side Diff: pkg/mdv/lib/mdv.dart

Issue 22253002: fix packages for latest SDK changes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // TODO(jmesserly): more commentary here. 5 // TODO(jmesserly): more commentary here.
6 /** 6 /**
7 * This library provides access to Model-Driven-Views APIs on HTML elements. 7 * This library provides access to Model-Driven-Views APIs on HTML elements.
8 * More information can be found at: <https://github.com/toolkitchen/mdv>. 8 * More information can be found at: <https://github.com/toolkitchen/mdv>.
9 */ 9 */
10 library mdv; 10 library mdv;
(...skipping 18 matching lines...) Expand all
29 part 'src/template.dart'; 29 part 'src/template.dart';
30 part 'src/template_iterator.dart'; 30 part 'src/template_iterator.dart';
31 part 'src/text.dart'; 31 part 'src/text.dart';
32 part 'src/text_area_element.dart'; 32 part 'src/text_area_element.dart';
33 33
34 /** Initialize the Model-Driven Views polyfill. */ 34 /** Initialize the Model-Driven Views polyfill. */
35 void initialize() { 35 void initialize() {
36 TemplateElement.mdvPackage = _mdv; 36 TemplateElement.mdvPackage = _mdv;
37 } 37 }
38 38
39 StreamController<DocumentFragment> _instanceCreated; 39
40 typedef DocumentFragmentCreated(DocumentFragment fragment);
41
42 // TODO(jmesserly): ideally this would be a stream, but they don't allow
43 // reentrancy.
44 Set<DocumentFragmentCreated> _instanceCreated;
40 45
41 /** 46 /**
42 * *Warning*: This is an implementation helper for Model-Driven Views and 47 * *Warning*: This is an implementation helper for Model-Driven Views and
43 * should not be used in your code. 48 * should not be used in your code.
44 * 49 *
45 * This event is fired whenever a template is instantiated via 50 * This event is fired whenever a template is instantiated via
46 * [Element.createInstance]. 51 * [Element.createInstance].
47 */ 52 */
53 // TODO(jmesserly): This is a hack, and is neccesary for the polyfill
54 // because custom elements are not upgraded during clone()
Siggi Cherem (dart-lang) 2013/08/05 20:20:52 seems the same as the TODO below, remove?
Jennifer Messerly 2013/08/05 20:51:15 Done.
48 // TODO(rafaelw): This is a hack, and is neccesary for the polyfill 55 // TODO(rafaelw): This is a hack, and is neccesary for the polyfill
49 // because custom elements are not upgraded during clone() 56 // because custom elements are not upgraded during clone()
50 // TODO(jmesserly): polymer removed this in: 57 // TODO(jmesserly): polymer removed this in:
51 // https://github.com/Polymer/platform/commit/344ffeaae475babb529403f6608588a0fc 73f4e7 58 // https://github.com/Polymer/platform/commit/344ffeaae475babb529403f6608588a0fc 73f4e7
52 Stream<DocumentFragment> get instanceCreated { 59 Set<DocumentFragmentCreated> get instanceCreated {
Siggi Cherem (dart-lang) 2013/08/05 20:20:52 an alternative pattern to consider would be to do
Jennifer Messerly 2013/08/05 20:51:15 yeah, this is basically private API though that sh
53 if (_instanceCreated == null) { 60 if (_instanceCreated == null) {
54 _instanceCreated = new StreamController<DocumentFragment>(sync: true); 61 _instanceCreated = new Set<DocumentFragmentCreated>();
55 } 62 }
56 return _instanceCreated.stream; 63 return _instanceCreated;
57 } 64 }
58 65
59 66
60 // TODO(jmesserly): investigate if expandos give us enough performance. 67 // TODO(jmesserly): investigate if expandos give us enough performance.
61 68
62 // The expando for storing our MDV wrappers. 69 // The expando for storing our MDV wrappers.
63 // 70 //
64 // In general, we need state associated with the nodes. Rather than having a 71 // In general, we need state associated with the nodes. Rather than having a
65 // bunch of individual expandos, we keep one per node. 72 // bunch of individual expandos, we keep one per node.
66 // 73 //
(...skipping 23 matching lines...) Expand all
90 } else if (node is Node) { 97 } else if (node is Node) {
91 wrapper = new _NodeExtension(node); 98 wrapper = new _NodeExtension(node);
92 } else { 99 } else {
93 // TODO(jmesserly): this happens for things like CompoundBinding. 100 // TODO(jmesserly): this happens for things like CompoundBinding.
94 wrapper = node; 101 wrapper = node;
95 } 102 }
96 103
97 _mdvExpando[node] = wrapper; 104 _mdvExpando[node] = wrapper;
98 return wrapper; 105 return wrapper;
99 } 106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698