OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 library web_components.custom_element; |
| 5 |
| 6 import 'dart:html' show document; |
| 7 import 'package:initialize/initialize.dart'; |
| 8 |
| 9 /// Annotation which registers a custom element with the main document. |
| 10 class CustomElement implements Initializer<Type> { |
| 11 /// The tag you want to register the class to handle. |
| 12 final String tag; |
| 13 |
| 14 /// If this element extends a native html element, then this is the tag that |
| 15 /// represents that element. |
| 16 final String extendsTag; |
| 17 |
| 18 const CustomElement(this.tag, {this.extendsTag}); |
| 19 |
| 20 void initialize(Type t) => |
| 21 document.registerElement(tag, t, extendsTag: extendsTag); |
| 22 } |
OLD | NEW |