Skip to content

Commit 1cf0faa

Browse files
committed
Make tweaks to parent class def
1 parent d681e17 commit 1cf0faa

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

lib/src/node/worker_threads.dart

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
// Copyright 2017 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';
88
import 'package:js/js_util.dart';
99

10-
@JS()
11-
external Object _requireWorkerThreads(String path);
10+
typedef _WorkerThreads = void Function() Function(
11+
String Function(String), String Function(String));
12+
13+
@JS('require')
14+
external Object _requireWorkerThreads(String name);
1215

13-
final workers = _requireWorkerThreads("worker_threads");
16+
final _worker = _requireWorkerThreads("worker_threads");
1417

1518
@JS()
1619
external Object get workerData;
@@ -46,7 +49,9 @@ class PortOptions {
4649
@JS()
4750
external ParentPort get parentPort;
4851

49-
@JS()
50-
class ParentPort {
51-
external static void postMessage(Object message, PortOptions options);
52+
@JS("parentPort")
53+
@anonymous
54+
abstract class ParentPort {
55+
external factory ParentPort({Function postMessage});
56+
external void postMessage(Object message, PortOptions options);
5257
}

0 commit comments

Comments
 (0)