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 |
| 5 // Dart test for testing isolation across multiple script tags. |
| 6 library multiscript_js_interop; |
| 7 import 'package:js/js.dart'; |
| 8 |
| 9 typedef int GetValue(); |
| 10 |
| 11 @JS('window') |
| 12 class State { |
| 13 // Static stored in Dart so there is a unique value in each Dart DOM isolate. |
| 14 static int sDart = 0; |
| 15 |
| 16 @JS('sJs') |
| 17 external static List<UpdateValue> get sJs; |
| 18 @JS('sJs') |
| 19 external static set sJs(List<UpdateValue> v); |
| 20 |
| 21 static int getValue() { return sDart; } |
| 22 |
| 23 static update() { |
| 24 sDart++; |
| 25 // We set this JS value from Dart to verify that JS Interop can pass Arrays |
| 26 // between Dart and JS correctly. |
| 27 if (sJs == null) { |
| 28 sJs = <UpdateValue>[]; |
| 29 } |
| 30 sJs.add(allowInterop(getValue)); |
| 31 } |
| 32 |
| 33 @JS('registerCallback') |
| 34 external static registerCallback(int index, Function callback); |
| 35 } |
OLD | NEW |