Chromium Code Reviews| 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 /** Annotation used to automatically register polymer elements. */ | 7 /** Annotation used to automatically register polymer elements. */ |
| 8 class CustomTag { | 8 class CustomTag { |
| 9 final String tagName; | 9 final String tagName; |
| 10 const CustomTag(this.tagName); | 10 const CustomTag(this.tagName); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 * [CustomTag] and invoke the initialization method on it. If [libraries] | 25 * [CustomTag] and invoke the initialization method on it. If [libraries] |
| 26 * is null, first find all libraries that need to be loaded by scanning for | 26 * is null, first find all libraries that need to be loaded by scanning for |
| 27 * HTML imports in the main document. | 27 * HTML imports in the main document. |
| 28 * | 28 * |
| 29 * The initialization on each library is a top-level function and annotated with | 29 * The initialization on each library is a top-level function and annotated with |
| 30 * [initMethod]. | 30 * [initMethod]. |
| 31 * | 31 * |
| 32 * The urls in [libraries] can be absolute or relative to | 32 * The urls in [libraries] can be absolute or relative to |
| 33 * `currentMirrorSystem().isolate.rootLibrary.uri`. | 33 * `currentMirrorSystem().isolate.rootLibrary.uri`. |
| 34 */ | 34 */ |
| 35 void initPolymer() { | 35 Zone initPolymer() { |
| 36 if (_useDirtyChecking) { | 36 if (_useDirtyChecking) { |
| 37 dirtyCheckZone().run(_initPolymerOptimized); | 37 var zone = dirtyCheckZone(); |
|
Jennifer Messerly
2013/10/29 02:16:17
return dirtyCheckZone()..run(_initPolymerOptimized
Siggi Cherem (dart-lang)
2013/10/29 02:53:14
Done. beautiful =)
| |
| 38 } else { | 38 zone.run(_initPolymerOptimized); |
| 39 _initPolymerOptimized(); | 39 return zone; |
| 40 } | 40 } |
| 41 | |
| 42 _initPolymerOptimized(); | |
| 43 return Zone.current; | |
| 41 } | 44 } |
| 42 | 45 |
| 43 /** | 46 /** |
| 44 * Same as [initPolymer], but runs the version that is optimized for deployment | 47 * Same as [initPolymer], but runs the version that is optimized for deployment |
| 45 * to the internet. The biggest difference is it omits the [Zone] that | 48 * to the internet. The biggest difference is it omits the [Zone] that |
| 46 * automatically invokes [Observable.dirtyCheck], and the list of libraries must | 49 * automatically invokes [Observable.dirtyCheck], and the list of libraries must |
| 47 * be supplied instead of being dynamically searched for at runtime. | 50 * be supplied instead of being dynamically searched for at runtime. |
| 48 */ | 51 */ |
| 49 // TODO(jmesserly): change the Polymer build step to call this directly. | 52 // TODO(jmesserly): change the Polymer build step to call this directly. |
| 50 void _initPolymerOptimized() { | 53 void _initPolymerOptimized() { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 print("warning: methods marked with @initMethod should take no " | 211 print("warning: methods marked with @initMethod should take no " |
| 209 "arguments, ${method.simpleName} expects some."); | 212 "arguments, ${method.simpleName} expects some."); |
| 210 return; | 213 return; |
| 211 } | 214 } |
| 212 obj.invoke(method.simpleName, const []); | 215 obj.invoke(method.simpleName, const []); |
| 213 } | 216 } |
| 214 | 217 |
| 215 class _InitMethodAnnotation { | 218 class _InitMethodAnnotation { |
| 216 const _InitMethodAnnotation(); | 219 const _InitMethodAnnotation(); |
| 217 } | 220 } |
| OLD | NEW |