Index: LayoutTests/dart/multiscript-js-interop.dart |
diff --git a/LayoutTests/dart/multiscript-js-interop.dart b/LayoutTests/dart/multiscript-js-interop.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a795bffa5701baca80bd8f7bce3455bde587e2d2 |
--- /dev/null |
+++ b/LayoutTests/dart/multiscript-js-interop.dart |
@@ -0,0 +1,35 @@ |
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+// Dart test for testing isolation across multiple script tags. |
+library multiscript_js_interop; |
+import 'package:js/js.dart'; |
+ |
+typedef int GetValue(); |
+ |
+@JS('window') |
+class State { |
+ // Static stored in Dart so there is a unique value in each Dart DOM isolate. |
+ static int sDart = 0; |
+ |
+ @JS('sJs') |
+ external static List<UpdateValue> get sJs; |
+ @JS('sJs') |
+ external static set sJs(List<UpdateValue> v); |
+ |
+ static int getValue() { return sDart; } |
+ |
+ static update() { |
+ sDart++; |
+ // We set this JS value from Dart to verify that JS Interop can pass Arrays |
+ // between Dart and JS correctly. |
+ if (sJs == null) { |
+ sJs = <UpdateValue>[]; |
+ } |
+ sJs.add(allowInterop(getValue)); |
+ } |
+ |
+ @JS('registerCallback') |
+ external static registerCallback(int index, Function callback); |
+} |