OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 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 | 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 library web_components.custom_element_proxy; |
| 5 |
4 import 'package:initialize/initialize.dart'; | 6 import 'package:initialize/initialize.dart'; |
5 import 'interop.dart'; | 7 import 'interop.dart'; |
6 | 8 |
7 /// Annotation for a dart class which proxies a javascript custom element. | 9 /// Annotation for a dart class which proxies a javascript custom element. |
8 /// This will not work unless `interop_support.js` is loaded. | 10 /// This will not work unless `interop_support.js` is loaded. |
9 // TODO(jakemac): Add an @HtmlImport here to a new file which includes | 11 // TODO(jakemac): Add an @HtmlImport here to a new file which includes |
10 // `interop_support.js`. We will need to point everything else at that html file | 12 // `interop_support.js`. We will need to point everything else at that html file |
11 // as well for deduplication purposes (could even just copy it in as an inline | 13 // as well for deduplication purposes (could even just copy it in as an inline |
12 // script so the js file no longer exists?). | 14 // script so the js file no longer exists?). |
13 class CustomElementProxy implements Initializer<Type> { | 15 class CustomElementProxy implements Initializer<Type> { |
14 final String tagName; | 16 final String tagName; |
15 final String extendsTag; | 17 final String extendsTag; |
16 | 18 |
17 const CustomElementProxy(this.tagName, {this.extendsTag}); | 19 const CustomElementProxy(this.tagName, {this.extendsTag}); |
18 | 20 |
19 void initialize(Type t) { | 21 void initialize(Type t) { |
20 registerDartType(tagName, t, extendsTag: extendsTag); | 22 registerDartType(tagName, t, extendsTag: extendsTag); |
21 } | 23 } |
22 } | 24 } |
OLD | NEW |