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

Unified Diff: lib/custom_element_proxy.dart

Issue 839013003: CustomElementProxy annotation (Closed) Base URL: git@github.com:dart-lang/web-components.git@master
Patch Set: update initialize dependency Created 5 years, 11 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 | « CHANGELOG.md ('k') | lib/interop.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/custom_element_proxy.dart
diff --git a/lib/custom_element_proxy.dart b/lib/custom_element_proxy.dart
new file mode 100644
index 0000000000000000000000000000000000000000..f9df88f6e0b5447b3c0769dd2810d6911196a434
--- /dev/null
+++ b/lib/custom_element_proxy.dart
@@ -0,0 +1,22 @@
+// 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.
+import 'package:initialize/initialize.dart';
+import 'interop.dart';
+
+/// Annotation for a dart class which proxies a javascript custom element.
+/// This will not work unless `interop_support.js` is loaded.
+// TODO(jakemac): Add an @HtmlImport here to a new file which includes
+// `interop_support.js`. We will need to point everything else at that html file
+// as well for deduplication purposes (could even just copy it in as an inline
+// script so the js file no longer exists?).
+class CustomElementProxy implements Initializer<Type> {
+ final String tagName;
+ final String extendsTag;
+
+ const CustomElementProxy(this.tagName, {this.extendsTag});
+
+ void initialize(Type t) {
+ registerDartType(tagName, t, extendsTag: extendsTag);
+ }
+}
« no previous file with comments | « CHANGELOG.md ('k') | lib/interop.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698