Skip to content

Commit 4d6caaa

Browse files
committed
Make tweaks to parent class def
1 parent 5f9e09c commit 4d6caaa

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/src/node/worker_threads.dart

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2020 Google Inc. Use of this source code is governed by an
22
// MIT-style license that can be found in the LICENSE file or at
33
// https://opensource.org/licenses/MIT.
4-
@JS()
4+
@JS("worker_threads")
55
library worker_threads;
66

77
import 'package:js/js.dart';
@@ -36,9 +36,16 @@ class Worker {
3636
external const factory Worker(String fileName, WorkerOptions options);
3737
}
3838

39+
@JS("parentPort")
40+
@anonymous
41+
class PortOptions {
42+
external List get transferList;
43+
external factory PortOptions({List<Object> transferList = const []});
44+
}
45+
3946
@JS("parentPort")
4047
@anonymous
4148
abstract class ParentPort {
42-
external factory ParentPort();
43-
external void postMessage(Object message);
49+
external factory ParentPort({Function postMessage});
50+
external void postMessage(Object message, PortOptions options);
4451
}

0 commit comments

Comments
 (0)