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 | 4 |
5 library dom; | 5 library dom; |
6 | 6 |
7 class JsType { | 7 class JsType { |
8 /// The JavaScript constructor function name. | 8 /// The JavaScript constructor function name. |
9 /// Used for construction and instanceof checks. | 9 /// Used for construction and instanceof checks. |
10 /// Note that this could be an expression, e.g. `lib.TypeName` in JS, but it | 10 /// Note that this could be an expression, e.g. `lib.TypeName` in JS, but it |
11 /// should be kept simple, as it will be generated directly into the code. | 11 /// should be kept simple, as it will be generated directly into the code. |
12 final String name; | 12 final String name; |
13 const JsType({this.name}); | 13 const JsType({this.name}); |
14 } | 14 } |
15 class JsGlobal { | 15 class JsGlobal { |
16 const JsGlobal(); | 16 const JsGlobal(); |
17 } | 17 } |
18 class Overload { | 18 class Overload { |
19 const Overload(); | 19 const Overload(); |
20 } | 20 } |
21 const overload = const Overload(); | 21 const overload = const Overload(); |
22 | 22 |
23 // TODO(jmesserly): uncomment once fix lands for: | 23 @JsGlobal() |
24 // https://github.com/dart-lang/dart_style/issues/85 | 24 final Document document = null; |
25 // @JsGlobal() | |
26 final Document document; | |
27 | 25 |
28 @JsType(name: 'Document') | 26 @JsType(name: 'Document') |
29 abstract class Document { | 27 abstract class Document { |
30 Element querySelector(String selector); | 28 Element querySelector(String selector); |
31 } | 29 } |
32 | 30 |
33 @JsType(name: 'Element') | 31 @JsType(name: 'Element') |
34 abstract class Element { | 32 abstract class Element { |
35 void addEventListener(String type, EventListener callback, [bool capture]); | 33 void addEventListener(String type, EventListener callback, [bool capture]); |
36 String textContent; | 34 String textContent; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 abstract class TextMetrics { | 184 abstract class TextMetrics { |
187 num get width; | 185 num get width; |
188 } | 186 } |
189 | 187 |
190 @JsType() | 188 @JsType() |
191 abstract class ImageData { | 189 abstract class ImageData { |
192 int get width; | 190 int get width; |
193 int get height; | 191 int get height; |
194 // TODO: readonly Uint8ClampedArray data; | 192 // TODO: readonly Uint8ClampedArray data; |
195 } | 193 } |
OLD | NEW |