OLD | NEW |
1 Methods and annotations to specify interoperability with JavaScript APIs. | 1 Methods and annotations to specify interoperability with JavaScript APIs. |
2 | 2 |
3 *Note: This package is beta software.* | 3 *Note: This package is beta software.* |
4 | 4 |
5 *Note: This packages requires Dart SDK `>=1.13.0-dev.7`.* | 5 *Note: This packages requires Dart SDK `>=1.13.0-dev.7`.* |
6 | 6 |
7 ### Adding the dependency | 7 ### Adding the dependency |
8 | 8 |
9 Add the following to your `pubspec.yaml`: | 9 Add the following to your `pubspec.yaml`: |
10 | 10 |
11 ```yaml | 11 ```yaml |
12 dependencies: | 12 dependencies: |
13 js: ^0.6.0-beta | 13 js: ^0.6.0-beta |
14 ``` | 14 ``` |
15 | 15 |
16 #### Passing functions to JavaScript. | 16 #### Passing functions to JavaScript. |
17 | 17 |
18 If you are passing a Dart function to a JavaScript API, you must wrap it using | 18 If you are passing a Dart function to a JavaScript API, you must wrap it using |
19 `allowInterop` or `allowInteropCaptureThis`. | 19 `allowInterop` or `allowInteropCaptureThis`. |
20 | 20 |
21 ### Examples | 21 ### Examples |
22 | 22 |
23 There is a [full example](https://github.com/dart-lang/sdk/tree/master/pkg/js/ex
ample) hosted with the `package:js` source code. | 23 See the [Chart.js Dart API](https://github.com/google/chartjs.dart/) for an |
| 24 end-to-end example. |
24 | 25 |
25 #### Calling methods | 26 #### Calling methods |
26 | 27 |
27 ```dart | 28 ```dart |
28 // Calls invoke JavaScript `JSON.stringify(obj)`. | 29 // Calls invoke JavaScript `JSON.stringify(obj)`. |
29 @JS("JSON.stringify") | 30 @JS("JSON.stringify") |
30 external String stringify(obj); | 31 external String stringify(obj); |
31 ``` | 32 ``` |
32 | 33 |
33 #### Classes and Namespaces | 34 #### Classes and Namespaces |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 ## Contributing and Filing Bugs | 94 ## Contributing and Filing Bugs |
94 | 95 |
95 Please file bugs and features requests on the [Github issue tracker](https://git
hub.com/dart-lang/sdk/issues). | 96 Please file bugs and features requests on the [Github issue tracker](https://git
hub.com/dart-lang/sdk/issues). |
96 | 97 |
97 We also love and accept community contributions, from API suggestions to pull re
quests. | 98 We also love and accept community contributions, from API suggestions to pull re
quests. |
98 Please file an issue before beginning work so we can discuss the design and impl
ementation. | 99 Please file an issue before beginning work so we can discuss the design and impl
ementation. |
99 We are trying to create issues for all current and future work, so if something
there intrigues you (or you need it!) join in on the discussion. | 100 We are trying to create issues for all current and future work, so if something
there intrigues you (or you need it!) join in on the discussion. |
100 | 101 |
101 Code contributors must sign the | 102 Code contributors must sign the |
102 [Google Individual Contributor License Agreement](https://developers.google.com/
open-source/cla/individual?csw=1). | 103 [Google Individual Contributor License Agreement](https://developers.google.com/
open-source/cla/individual?csw=1). |
OLD | NEW |