OLD | NEW |
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 part of polymer; | 5 part of polymer; |
6 | 6 |
7 /** | 7 /** |
8 * Use this annotation to publish a field as an attribute. For example: | 8 * Use this annotation to publish a field as an attribute. For example: |
9 * | 9 * |
10 * class MyPlaybackElement extends PolymerElement { | 10 * class MyPlaybackElement extends PolymerElement { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 * which resets the timer. For example: | 122 * which resets the timer. For example: |
123 * | 123 * |
124 * _myJob = job(_myJob, callback, const Duration(milliseconds: 100)); | 124 * _myJob = job(_myJob, callback, const Duration(milliseconds: 100)); |
125 * | 125 * |
126 * Returns a job handle which can be used to re-register a job. | 126 * Returns a job handle which can be used to re-register a job. |
127 */ | 127 */ |
128 Job job(Job job, void callback(), Duration wait) => | 128 Job job(Job job, void callback(), Duration wait) => |
129 runJob(job, callback, wait); | 129 runJob(job, callback, wait); |
130 | 130 |
131 void polymerCreated() { | 131 void polymerCreated() { |
132 if (this.document.window != null || alwaysPrepare || | 132 if (this.ownerDocument.window != null || alwaysPrepare || |
133 _preparingElements > 0) { | 133 _preparingElements > 0) { |
134 prepareElement(); | 134 prepareElement(); |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 void prepareElement() { | 138 void prepareElement() { |
139 // Dart note: get the _declaration, which also marks _elementPrepared | 139 // Dart note: get the _declaration, which also marks _elementPrepared |
140 _declaration = _getDeclaration(this.runtimeType); | 140 _declaration = _getDeclaration(this.runtimeType); |
141 // do this first so we can observe changes during initialization | 141 // do this first so we can observe changes during initialization |
142 observeProperties(); | 142 observeProperties(); |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 /** | 952 /** |
953 * Base class for PolymerElements deriving from HtmlElement. | 953 * Base class for PolymerElements deriving from HtmlElement. |
954 * | 954 * |
955 * See [Polymer]. | 955 * See [Polymer]. |
956 */ | 956 */ |
957 class PolymerElement extends HtmlElement with Polymer, Observable { | 957 class PolymerElement extends HtmlElement with Polymer, Observable { |
958 PolymerElement.created() : super.created() { | 958 PolymerElement.created() : super.created() { |
959 polymerCreated(); | 959 polymerCreated(); |
960 } | 960 } |
961 } | 961 } |
OLD | NEW |