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 /// Use this annotation to publish a property as an attribute. | 7 /// Use this annotation to publish a property as an attribute. |
8 /// | 8 /// |
9 /// You can also use [PublishedProperty] to provide additional information, | 9 /// You can also use [PublishedProperty] to provide additional information, |
10 /// such as automatically syncing the property back to the attribute. | 10 /// such as automatically syncing the property back to the attribute. |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 [urls, () => completer.complete()]); | 214 [urls, () => completer.complete()]); |
215 return completer.future; | 215 return completer.future; |
216 } | 216 } |
217 | 217 |
218 static final Completer _onReady = new Completer(); | 218 static final Completer _onReady = new Completer(); |
219 | 219 |
220 /// Future indicating that the Polymer library has been loaded and is ready | 220 /// Future indicating that the Polymer library has been loaded and is ready |
221 /// for use. | 221 /// for use. |
222 static Future get onReady => _onReady.future; | 222 static Future get onReady => _onReady.future; |
223 | 223 |
| 224 /// Returns a list of elements that have had polymer-elements created but |
| 225 /// are not yet ready to register. The list is an array of element |
| 226 /// definitions. |
| 227 static List<Element> get waitingFor => |
| 228 _Polymer.callMethod('waitingFor', [null]); |
| 229 |
| 230 /// Forces polymer to register any pending elements. Can be used to abort |
| 231 /// waiting for elements that are partially defined. |
| 232 static forceReady([int timeout]) => |
| 233 _Polymer.callMethod('forceReady', [null, timeout]); |
| 234 |
224 /// The most derived `<polymer-element>` declaration for this element. | 235 /// The most derived `<polymer-element>` declaration for this element. |
225 PolymerDeclaration get element => _element; | 236 PolymerDeclaration get element => _element; |
226 PolymerDeclaration _element; | 237 PolymerDeclaration _element; |
227 | 238 |
228 /// Deprecated: use [element] instead. | 239 /// Deprecated: use [element] instead. |
229 @deprecated PolymerDeclaration get declaration => _element; | 240 @deprecated PolymerDeclaration get declaration => _element; |
230 | 241 |
231 Map<String, StreamSubscription> _namedObservers; | 242 Map<String, StreamSubscription> _namedObservers; |
232 List<Bindable> _observers = []; | 243 List<Bindable> _observers = []; |
233 | 244 |
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 /// | 1272 /// |
1262 /// _myJob = Polymer.scheduleJob(_myJob, callback); | 1273 /// _myJob = Polymer.scheduleJob(_myJob, callback); |
1263 /// | 1274 /// |
1264 /// Returns the newly created job. | 1275 /// Returns the newly created job. |
1265 // Dart note: renamed to scheduleJob to be a bit more consistent with Dart. | 1276 // Dart note: renamed to scheduleJob to be a bit more consistent with Dart. |
1266 PolymerJob scheduleJob(PolymerJob job, void callback(), [Duration wait]) { | 1277 PolymerJob scheduleJob(PolymerJob job, void callback(), [Duration wait]) { |
1267 if (job == null) job = new PolymerJob._(); | 1278 if (job == null) job = new PolymerJob._(); |
1268 // Dart note: made start smarter, so we don't need to call stop. | 1279 // Dart note: made start smarter, so we don't need to call stop. |
1269 return job..start(callback, wait); | 1280 return job..start(callback, wait); |
1270 } | 1281 } |
| 1282 |
| 1283 /// Inject HTML which contains markup bound to this element into |
| 1284 /// a target element (replacing target element content). |
| 1285 DocumentFragment injectBoundHTML(String html, [Element element]) { |
| 1286 var template = new TemplateElement()..innerHtml = html; |
| 1287 var fragment = this.instanceTemplate(template); |
| 1288 if (element != null) { |
| 1289 element.text = ''; |
| 1290 element.append(fragment); |
| 1291 } |
| 1292 return fragment; |
| 1293 } |
1271 } | 1294 } |
1272 | 1295 |
1273 // Dart note: this is related to _bindOldStylePublishedProperty. Polymer | 1296 // Dart note: this is related to _bindOldStylePublishedProperty. Polymer |
1274 // addresses n-way bindings by metaprogramming: redefine the property on the | 1297 // addresses n-way bindings by metaprogramming: redefine the property on the |
1275 // PolymerElement instance to always get its value from the model@path. This is | 1298 // PolymerElement instance to always get its value from the model@path. This is |
1276 // supported in Dart using a new style of @published property declaration using | 1299 // supported in Dart using a new style of @published property declaration using |
1277 // the `readValue` and `writeValue` methods above. In the past we used to work | 1300 // the `readValue` and `writeValue` methods above. In the past we used to work |
1278 // around this by listening to changes on both sides and updating the values. | 1301 // around this by listening to changes on both sides and updating the values. |
1279 // This object provides the hooks to do this. | 1302 // This object provides the hooks to do this. |
1280 // TODO(sigmund,jmesserly): delete after a deprecation period. | 1303 // TODO(sigmund,jmesserly): delete after a deprecation period. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 final Logger _eventsLog = new Logger('polymer.events'); | 1369 final Logger _eventsLog = new Logger('polymer.events'); |
1347 final Logger _unbindLog = new Logger('polymer.unbind'); | 1370 final Logger _unbindLog = new Logger('polymer.unbind'); |
1348 final Logger _bindLog = new Logger('polymer.bind'); | 1371 final Logger _bindLog = new Logger('polymer.bind'); |
1349 final Logger _watchLog = new Logger('polymer.watch'); | 1372 final Logger _watchLog = new Logger('polymer.watch'); |
1350 final Logger _readyLog = new Logger('polymer.ready'); | 1373 final Logger _readyLog = new Logger('polymer.ready'); |
1351 | 1374 |
1352 final Expando _eventHandledTable = new Expando<Set<Node>>(); | 1375 final Expando _eventHandledTable = new Expando<Set<Node>>(); |
1353 | 1376 |
1354 final JsObject _PolymerGestures = js.context['PolymerGestures']; | 1377 final JsObject _PolymerGestures = js.context['PolymerGestures']; |
1355 | 1378 |
OLD | NEW |