OLD | NEW |
1 #library('actors'); | 1 #library('actors'); |
2 #source('actors.dart'); | 2 #source('actors.dart'); |
3 #source('actors-interface.dart'); | 3 #source('actors-interface.dart'); |
4 #source('actors-ui.dart'); | 4 #source('actors-ui.dart'); |
5 | 5 |
6 class _WindowActor extends Actor { | 6 class _WindowActor extends Actor { |
7 _WindowActor() : super() { | 7 _WindowActor() : super() { |
8 on["print"] = (String m) { | 8 on["print"] = (String m) { |
9 print("${m}"); | 9 print("${m}"); |
10 }; | 10 }; |
11 | 11 |
12 /** | 12 /** |
13 * Sends a message back using the 'reply' parameter after specified number | 13 * Sends a message back using the 'reply' parameter after specified number |
14 * of milliseconds specified by 'timeout' parameter. | 14 * of milliseconds specified by 'timeout' parameter. |
15 */ | 15 */ |
16 on["setTimeout"] = (Reply reply, int timeout) { | 16 on["setTimeout"] = (Reply reply, int timeout) { |
17 new Timer((Timer t) {reply.respond();}, timeout); | 17 new Timer(timeout, (Timer t) {reply.respond();}); |
18 }; | 18 }; |
19 } | 19 } |
20 } | 20 } |
21 | 21 |
22 class _WindowProxyImpl extends _NullWindowProxy { | 22 class _WindowProxyImpl extends _NullWindowProxy { |
23 ActorId _window; | 23 ActorId _window; |
24 _WindowProxyImpl(this._window); | 24 _WindowProxyImpl(this._window); |
25 | 25 |
26 void print(String m) => _window.send("print", [m]); | 26 void print(String m) => _window.send("print", [m]); |
27 | 27 |
28 void setTimeout(Reply t, int timeout) => | 28 void setTimeout(Reply t, int timeout) => |
29 _window.send("setTimeout", [t, timeout]); | 29 _window.send("setTimeout", [t, timeout]); |
30 } | 30 } |
OLD | NEW |