stockfishMain method

  1. @override
Future<int> stockfishMain(
  1. Function active
)
override

Implementation

@override
Future<int> stockfishMain(Function active) async {
  if (loadJs != null) {
    await loadJs;
    loadJs = null;
  }
  final completer = Completer<int>();
  js.context.callMethod("start_listening", [
    (line) => stdoutController.sink.add(line),
    (state) {
      cleanUp(state is int ? state : 1);
      completer.complete(state is int ? state : 1);
    }
  ]);
  active();
  return completer.future;
}