| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 | 4 |
| 5 #library('isolate_sample'); | 5 library isolate_sample; |
| 6 | 6 |
| 7 #import('dart:html'); | 7 import 'dart:html'; |
| 8 #import('dart:isolate'); | 8 import 'dart:isolate'; |
| 9 #import('dart:math'); | 9 import 'dart:math'; |
| 10 | 10 |
| 11 /* | 11 /* |
| 12 * This is a simple sample application showing how to create two isolates | 12 * This is a simple sample application showing how to create two isolates |
| 13 * and send messages to them, and receive replies back. | 13 * and send messages to them, and receive replies back. |
| 14 */ | 14 */ |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * These are the messages we are going to send to the isolates that we create. | 17 * These are the messages we are going to send to the isolates that we create. |
| 18 */ | 18 */ |
| 19 class MessageId { | 19 class MessageId { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 ports[isolateName].call(message).then((var msg) { | 120 ports[isolateName].call(message).then((var msg) { |
| 121 replyElement.text = msg; | 121 replyElement.text = msg; |
| 122 }); | 122 }); |
| 123 }); | 123 }); |
| 124 } | 124 } |
| 125 | 125 |
| 126 port.receive((var message, SendPort replyTo) { | 126 port.receive((var message, SendPort replyTo) { |
| 127 replyElement.text = message; | 127 replyElement.text = message; |
| 128 }); | 128 }); |
| 129 } | 129 } |
| OLD | NEW |