Skip to content

Commit

Permalink
Make tweaks to parent class def
Browse files Browse the repository at this point in the history
  • Loading branch information
hegelocampus committed Jan 22, 2020
1 parent d681e17 commit 1cf0faa
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions lib/src/node/worker_threads.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
// Copyright 2017 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';
import 'package:js/js_util.dart';

@JS()
external Object _requireWorkerThreads(String path);
typedef _WorkerThreads = void Function() Function(
String Function(String), String Function(String));

@JS('require')
external Object _requireWorkerThreads(String name);

final workers = _requireWorkerThreads("worker_threads");
final _worker = _requireWorkerThreads("worker_threads");

@JS()
external Object get workerData;
Expand Down Expand Up @@ -46,7 +49,9 @@ class PortOptions {
@JS()
external ParentPort get parentPort;

@JS()
class ParentPort {
external static void postMessage(Object message, PortOptions options);
@JS("parentPort")
@anonymous
abstract class ParentPort {
external factory ParentPort({Function postMessage});
external void postMessage(Object message, PortOptions options);
}

0 comments on commit 1cf0faa

Please sign in to comment.