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

Side by Side Diff: web_components/lib/custom_element_proxy.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « web_components/lib/build/web_components.dart ('k') | web_components/lib/dart_support.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_proxy;
5
6 import 'dart:js' as js;
7 import 'package:initialize/initialize.dart';
8 import 'interop.dart';
9
10 /// Annotation for a dart class which proxies a javascript custom element.
11 /// This will not work unless `interop_support.js` is loaded.
12 // TODO(jakemac): Add an @HtmlImport here to a new file which includes
13 // `interop_support.js`. We will need to point everything else at that html file
14 // as well for deduplication purposes (could even just copy it in as an inline
15 // script so the js file no longer exists?).
16 class CustomElementProxy implements Initializer<Type> {
17 final String tagName;
18 final String extendsTag;
19
20 const CustomElementProxy(this.tagName, {this.extendsTag});
21
22 void initialize(Type t) {
23 registerDartType(tagName, t, extendsTag: extendsTag);
24 }
25 }
26
27 /// A simple mixin to make it easier to interoperate with the Javascript API of
28 /// a browser object. This is mainly used by classes that expose a Dart API for
29 /// Javascript custom elements.
30 class CustomElementProxyMixin {
31 js.JsObject _proxy;
32
33 js.JsObject get jsElement {
34 if (_proxy == null) {
35 _proxy = new js.JsObject.fromBrowserObject(this);
36 }
37 return _proxy;
38 }
39 }
OLDNEW
« no previous file with comments | « web_components/lib/build/web_components.dart ('k') | web_components/lib/dart_support.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698