From 4d6caaa1c249e603a272dae3e8273729485885e1 Mon Sep 17 00:00:00 2001 From: Bee Date: Wed, 22 Jan 2020 13:30:02 -0800 Subject: [PATCH] Make tweaks to parent class def --- lib/src/node/worker_threads.dart | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/src/node/worker_threads.dart b/lib/src/node/worker_threads.dart index b5f4b57ce..36bb0d8f1 100644 --- a/lib/src/node/worker_threads.dart +++ b/lib/src/node/worker_threads.dart @@ -1,7 +1,7 @@ // Copyright 2020 Google Inc. Use of this source code is governed by an // MIT-style license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. -@JS() +@JS("worker_threads") library worker_threads; import 'package:js/js.dart'; @@ -36,9 +36,16 @@ class Worker { external const factory Worker(String fileName, WorkerOptions options); } +@JS("parentPort") +@anonymous +class PortOptions { + external List get transferList; + external factory PortOptions({List transferList = const []}); +} + @JS("parentPort") @anonymous abstract class ParentPort { - external factory ParentPort(); - external void postMessage(Object message); + external factory ParentPort({Function postMessage}); + external void postMessage(Object message, PortOptions options); }