| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:isolate'; | 4 import 'dart:isolate'; |
| 5 | 5 |
| 6 var subscription; | 6 var subscription; |
| 7 | 7 |
| 8 void onData(x) { | 8 void onData(x) { |
| 9 print(x); | 9 print(x); |
| 10 subscription.cancel(); | 10 subscription.cancel(); |
| 11 } | 11 } |
| 12 | 12 |
| 13 main() { | 13 main() { |
| 14 var string = new String.fromCharCode(65); // External string factory. | 14 var string = new String.fromCharCode(65); // External string factory. |
| 15 var port = new ReceivePort(); // External factory. | 15 var port = new ReceivePort(); // External factory. |
| 16 subscription = port.listen(onData); // Dynamic call on external instance. | 16 subscription = port.listen(onData); // Dynamic call on external instance. |
| 17 port.sendPort.send(string); | 17 port.sendPort.send(string); |
| 18 } | 18 } |
| OLD | NEW |