OLD | NEW |
(Empty) | |
| 1 library merged_callstack_test; |
| 2 |
| 3 import 'dart:core' as core; // import with prefix so global dart:core fields don
't appear in scope chain. |
| 4 import 'dart:html' as html; // import with prefix so global dart:html fields don
't appear in scope chain. |
| 5 import 'dart:js' as js; // import with prefix so global dart:js fields don't
apppear in scope chain. |
| 6 |
| 7 main() { |
| 8 html.window.onMessage.listen(handleMessage); |
| 9 } |
| 10 |
| 11 handleMessage(event) { |
| 12 if (event.data == 'fromJS') { |
| 13 bounceDart(10); |
| 14 } |
| 15 } |
| 16 |
| 17 bounceHelperDart(core.int count) { |
| 18 js.context.callMethod("bounce", [count-1, bounceDart]); |
| 19 } |
| 20 |
| 21 bounceDart(core.int count) { |
| 22 if (count > 0) { |
| 23 core.Function.apply(bounceHelperDart, [count]); |
| 24 } else { |
| 25 html.window.postMessage('fromDart', '*'); |
| 26 } |
| 27 } |
OLD | NEW |