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

Unified Diff: lib/src/init.dart

Issue 1026153002: add initWebComponents (Closed) Base URL: git@github.com:dart-lang/web-components.git@master
Patch Set: code review updates Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/init.dart ('k') | lib/src/mirror_initializer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/init.dart
diff --git a/lib/src/init.dart b/lib/src/init.dart
new file mode 100644
index 0000000000000000000000000000000000000000..512134da1d6853195ea865290aa17f3590d1c788
--- /dev/null
+++ b/lib/src/init.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2015, 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.
+library web_components.src.init;
+
+import 'dart:async';
+import 'package:initialize/initialize.dart' show InitializerFilter;
+import 'package:web_components/web_components.dart';
+import 'mirror_initializer.dart' as init;
+
+/// Performs html import aware initialization by crawling all imported documents
+/// and initializing any script tags which appear in them.
+///
+/// By default, this will run all [HtmlImport] initializers, followed in a 2nd
+/// phase by all [CustomElement] and [CustomElementProxy] initializers. Then,
+/// unless [initAll] is [false], it will run all remaining initializers.
+///
+/// If a [typeFilter] or [customFilter] are supplied, only one phase is ran
+/// with the supplied filters.
+Future initWebComponents({List<Type> typeFilter, InitializerFilter customFilter,
+ bool initAll: true}) {
+ if (typeFilter != null || customFilter != null) {
+ return init.run(typeFilter: typeFilter, customFilter: customFilter);
+ } else {
+ return init.run(typeFilter: [HtmlImport])
+ .then((_) => init.run(typeFilter: [CustomElement, CustomElementProxy]))
+ .then((_) => initAll ? init.run() : null);
+ }
+}
« no previous file with comments | « lib/init.dart ('k') | lib/src/mirror_initializer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698