Chromium Code Reviews| Index: pkg/polymer/lib/src/loader.dart |
| diff --git a/pkg/polymer/lib/polymer.dart b/pkg/polymer/lib/src/loader.dart |
| similarity index 65% |
| copy from pkg/polymer/lib/polymer.dart |
| copy to pkg/polymer/lib/src/loader.dart |
| index e417fe561b27762c95ee81c53736d1e0f0173091..e8cbb907da5a65396e5d5d39c25ea641deb03acb 100644 |
| --- a/pkg/polymer/lib/polymer.dart |
| +++ b/pkg/polymer/lib/src/loader.dart |
| @@ -1,59 +1,8 @@ |
| -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| -/** |
| - * Custom HTML tags, data binding, and templates for building |
| - * structured, encapsulated, client-side web apps. |
| - * |
| - * Polymer.dart, the next evolution of Web UI, |
| - * is an in-progress Dart port of the |
| - * [Polymer project](http://www.polymer-project.org/). |
| - * Polymer.dart compiles to JavaScript and runs across the modern web. |
| - * |
| - * To use polymer.dart in your application, |
| - * first add a |
| - * [dependency](http://pub.dartlang.org/doc/dependencies.html) |
| - * to the app's pubspec.yaml file. |
| - * Instead of using the open-ended `any` version specifier, |
| - * we recommend using a range of version numbers, as in this example: |
| - * |
| - * dependencies: |
| - * polymer: '>=0.7.1 <0.8' |
| - * |
| - * Then import the library into your application: |
| - * |
| - * import 'package:polymer/polymer.dart'; |
| - * |
| - * ## Other resources |
| - * |
| - * * [Polymer.dart homepage](http://www.dartlang.org/polymer-dart/): |
| - * Example code, project status, and |
| - * information about how to get started using Polymer.dart in your apps. |
| - * |
| - * * [polymer.dart package](http://pub.dartlang.org/packages/polymer): |
| - * More details, such as the current major release number. |
| - * |
| - * * [Upgrading to Polymer.dart](http://www.dartlang.org/polymer-dart/upgrading-to-polymer-from-web-ui.html): |
| - * Tips for converting your apps from Web UI to Polymer.dart. |
| - */ |
| -library polymer; |
| - |
| -import 'dart:async'; |
| -import 'dart:mirrors'; |
| - |
| -import 'package:mdv/mdv.dart' as mdv; |
| -import 'package:observe/src/microtask.dart'; |
| -import 'package:path/path.dart' as path; |
| -import 'polymer_element.dart' show registerPolymerElement; |
| - |
| -export 'package:custom_element/custom_element.dart'; |
| -export 'package:observe/observe.dart'; |
| -export 'package:observe/html.dart'; |
| -export 'package:observe/src/microtask.dart'; |
| - |
| -export 'polymer_element.dart'; |
| - |
| +part of polymer; |
| /** Annotation used to automatically register polymer elements. */ |
| class CustomTag { |
| @@ -80,17 +29,24 @@ const initMethod = const _InitMethodAnnotation(); |
| * The urls in [libraries] can be absolute or relative to [srcUrl]. |
| */ |
| void initPolymer(List<String> libraries, [String srcUrl]) { |
| - wrapMicrotask(() { |
| + runMicrotask(() { |
| // DOM events don't yet go through microtasks, so we catch those here. |
| new Timer.periodic(new Duration(milliseconds: 125), |
| (_) => performMicrotaskCheckpoint()); |
| // TODO(jmesserly): mdv should use initMdv instead of mdv.initialize. |
| mdv.initialize(); |
| + registerCustomElement('polymer-element', () => new PolymerDeclaration()); |
| + |
| for (var lib in libraries) { |
| _loadLibrary(lib, srcUrl); |
| } |
| - })(); |
| + |
| + // TODO(jmesserly): this should be in the custom_element polyfill, not here. |
| + // notify the system that we are bootstrapped |
| + document.body.dispatchEvent( |
|
blois
2013/09/27 21:40:52
Seems like this should be a separate event- when c
Jennifer Messerly
2013/09/30 17:44:37
I don't see why we'd need an extra event over poly
|
| + new CustomEvent('WebComponentsReady', canBubble: true)); |
| + }); |
| } |
| /** All libraries in the current isolate. */ |
| @@ -134,8 +90,7 @@ void _loadLibrary(String uriString, [String srcUrl]) { |
| for (var m in c.metadata) { |
| var meta = m.reflectee; |
| if (meta is CustomTag) { |
| - registerPolymerElement(meta.tagName, |
| - () => c.newInstance(const Symbol(''), const []).reflectee); |
| + Polymer._registerClassMirror(meta.tagName, c); |
| } |
| } |