OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 class WorkerEventsImplementation extends AbstractWorkerEventsImplementation | |
6 implements WorkerEvents { | |
7 WorkerEventsImplementation._wrap(_ptr) : super._wrap(_ptr); | |
8 | |
9 EventListenerList get message() => _get('message'); | |
10 } | |
11 | |
12 class WorkerWrappingImplementation extends EventTargetWrappingImplementation imp
lements Worker { | |
13 WorkerWrappingImplementation._wrap(ptr) : super._wrap(ptr) {} | |
14 | |
15 void postMessage(String message, [MessagePort messagePort = null]) { | |
16 if (messagePort === null) { | |
17 _ptr.postMessage(message); | |
18 return; | |
19 } else { | |
20 _ptr.postMessage(message, LevelDom.unwrap(messagePort)); | |
21 return; | |
22 } | |
23 } | |
24 | |
25 void terminate() { | |
26 _ptr.terminate(); | |
27 return; | |
28 } | |
29 | |
30 WorkerEvents get on() { | |
31 if (_on === null) { | |
32 _on = new WorkerEventsImplementation._wrap(_ptr); | |
33 } | |
34 return _on; | |
35 } | |
36 } | |
OLD | NEW |