Index: lib/src/custom_element.dart |
diff --git a/lib/src/custom_element.dart b/lib/src/custom_element.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1678fcc57a13dffb061de341e39b63920fe464eb |
--- /dev/null |
+++ b/lib/src/custom_element.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. |
+library web_components.custom_element; |
+ |
+import 'dart:html' show document; |
+import 'package:initialize/initialize.dart'; |
+ |
+/// Annotation which registers a custom element with the main document. |
+class CustomElement implements Initializer<Type> { |
+ /// The tag you want to register the class to handle. |
+ final String tag; |
+ |
+ /// If this element extends a native html element, then this is the tag that |
+ /// represents that element. |
+ final String extendsTag; |
+ |
+ const CustomElement(this.tag, {this.extendsTag}); |
+ |
+ void initialize(Type t) => |
+ document.registerElement(tag, t, extendsTag: extendsTag); |
+} |