OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 /** | 5 /** |
6 * These are the messages we are going to send to the isolates | 6 * These are the messages we are going to send to the isolates |
7 * that we create. | 7 * that we create. |
8 */ | 8 */ |
9 class MessageId { | 9 class MessageId { |
10 static final INIT = "init"; | 10 static final INIT = "init"; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 }); | 77 }); |
78 }); | 78 }); |
79 } | 79 } |
80 | 80 |
81 chirpPort.receive((var message, SendPort replyTo) { | 81 chirpPort.receive((var message, SendPort replyTo) { |
82 replyElement.text = message; | 82 replyElement.text = message; |
83 }); | 83 }); |
84 } | 84 } |
85 | 85 |
86 static void main() { | 86 static void main() { |
87 Dom.ready(void _() { new IsolateSample().ready(); }); | 87 new IsolateSample().ready(); |
88 } | 88 } |
89 | 89 |
90 // TODO(mattsh) get this off the System object once it's available | 90 // TODO(mattsh) get this off the System object once it's available |
91 // see http://b/issue?id=5215916 | 91 // see http://b/issue?id=5215916 |
92 static bool isVm() { | 92 static bool isVm() { |
93 return 1234567890123456789 % 2 > 0; | 93 return 1234567890123456789 % 2 > 0; |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 /** | 97 /** |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 "received message: <span class='messageText'>'${message}'</span>"; | 145 "received message: <span class='messageText'>'${message}'</span>"; |
146 if (div.query(".replyCheckbox").dynamic.checked) { | 146 if (div.query(".replyCheckbox").dynamic.checked) { |
147 InputElement element = div.query(".delayTextbox"); | 147 InputElement element = div.query(".delayTextbox"); |
148 int millis = Math.parseInt(element.value); | 148 int millis = Math.parseInt(element.value); |
149 window.setTimeout(() { | 149 window.setTimeout(() { |
150 replyTo.send("this is a reply from isolate '${isolateName}'", null); | 150 replyTo.send("this is a reply from isolate '${isolateName}'", null); |
151 }, millis); | 151 }, millis); |
152 } | 152 } |
153 } | 153 } |
154 } | 154 } |
OLD | NEW |