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

Side by Side Diff: lib/polymer.dart

Issue 22254002: fixes for latest SDK (Closed) Base URL: https://github.com/dart-lang/web-ui.git@master
Patch Set: fix comments 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 5 /**
6 * This library exports all of the commonly used functions and types for 6 * This library exports all of the commonly used functions and types for
7 * building UI's. 7 * building UI's.
8 * 8 *
9 * See this article for more information: 9 * See this article for more information:
10 * <http://www.dartlang.org/articles/dart-web-components/>. 10 * <http://www.dartlang.org/articles/dart-web-components/>.
11 */ 11 */
12 library polymer; 12 library polymer;
13 13
14 import 'dart:async'; 14 import 'dart:async';
15 import 'dart:mirrors'; 15 import 'dart:mirrors';
16 16
17 import 'package:custom_element/custom_element.dart';
17 import 'package:mdv/mdv.dart' as mdv; 18 import 'package:mdv/mdv.dart' as mdv;
18 import 'package:observe/observe.dart' show Observable; 19 import 'package:observe/observe.dart' show Observable;
20 import 'package:observe/src/microtask.dart';
19 import 'package:path/path.dart' as path; 21 import 'package:path/path.dart' as path;
20 import 'polymer_element.dart' show registerPolymerElement; 22 import 'polymer_element.dart' show registerPolymerElement;
21 23
22 export 'package:custom_element/custom_element.dart'; 24 export 'package:custom_element/custom_element.dart';
23 export 'package:observe/observe.dart'; 25 export 'package:observe/observe.dart';
26 export 'package:observe/src/microtask.dart';
24 27
25 export 'event.dart'; 28 export 'event.dart';
26 export 'observe.dart'; 29 export 'observe.dart';
27 export 'observe_html.dart'; 30 export 'observe_html.dart';
28 export 'polymer_element.dart'; 31 export 'polymer_element.dart';
29 export 'safe_html.dart'; 32 export 'safe_html.dart';
30 export 'scoped_css.dart'; 33 export 'scoped_css.dart';
31 34
32 35
33 /** Annotation used to automatically register polymer elements. */ 36 /** Annotation used to automatically register polymer elements. */
(...skipping 14 matching lines...) Expand all
48 * each library in [elementLibraries], and finally invoking [userMain]. 51 * each library in [elementLibraries], and finally invoking [userMain].
49 * 52 *
50 * There are two mechanisms by which custom elements can be initialized: 53 * There are two mechanisms by which custom elements can be initialized:
51 * annotating the class that declares a custom element with [CustomTag] or 54 * annotating the class that declares a custom element with [CustomTag] or
52 * programatically registering the element in a static or top-level function and 55 * programatically registering the element in a static or top-level function and
53 * annotating that function with [polymerInitMethod]. 56 * annotating that function with [polymerInitMethod].
54 * 57 *
55 * The urls in [elementLibraries] can be absolute or relative to [srcUrl]. 58 * The urls in [elementLibraries] can be absolute or relative to [srcUrl].
56 */ 59 */
57 initPolymer(List<String> elementLibraries, void userMain(), [String srcUrl]) { 60 initPolymer(List<String> elementLibraries, void userMain(), [String srcUrl]) {
58 new Timer.periodic(new Duration(milliseconds: 125), 61 wrapMicrotask(() {
59 (_) => Observable.dirtyCheck()); 62 // DOM events don't yet go through microtasks, so we catch those here.
63 new Timer.periodic(new Duration(milliseconds: 125),
64 (_) => performMicrotaskCheckpoint());
60 65
61 // TODO(jmesserly): mdv should use initMdv instead of mdv.initialize. 66 // TODO(jmesserly): mdv should use initMdv instead of mdv.initialize.
62 mdv.initialize(); 67 mdv.initialize();
63 for (var lib in elementLibraries) { 68 for (var lib in elementLibraries) {
64 _registerPolymerElementsOf(lib, srcUrl); 69 _registerPolymerElementsOf(lib, srcUrl);
65 } 70 }
66 userMain(); 71 userMain();
72 })();
67 } 73 }
68 74
69 /** All libraries in the current isolate. */ 75 /** All libraries in the current isolate. */
70 var _libs = currentMirrorSystem().libraries; 76 var _libs = currentMirrorSystem().libraries;
71 77
72 /** 78 /**
73 * Reads the library at [uriString] (which can be an absolute URI or a relative 79 * Reads the library at [uriString] (which can be an absolute URI or a relative
74 * URI from [srcUrl]), and: 80 * URI from [srcUrl]), and:
75 * 81 *
76 * * Invokes top-level and static functions marked with the 82 * * Invokes top-level and static functions marked with the
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 print("warning: methods marked with @polymerInitMethod should take no " 138 print("warning: methods marked with @polymerInitMethod should take no "
133 "arguments, ${method.simpleName} expects some."); 139 "arguments, ${method.simpleName} expects some.");
134 return; 140 return;
135 } 141 }
136 obj.invoke(method.simpleName, const []); 142 obj.invoke(method.simpleName, const []);
137 } 143 }
138 144
139 class _InitPolymerAnnotation { 145 class _InitPolymerAnnotation {
140 const _InitPolymerAnnotation(); 146 const _InitPolymerAnnotation();
141 } 147 }
OLDNEW
« no previous file with comments | « example/todomvc/web/todo_row.html ('k') | lib/polymer_element.dart » ('j') | pubspec.yaml » ('J')

Powered by Google App Engine
This is Rietveld 408576698