setEventHandler method

Future<CommandCompletion> setEventHandler(
  1. RuntimeEventHandler handler
)

Sends the events of the runtime and its maps to a callback.

The callback replaces the one set before.

See mln_runtime_set_event_handler in the C API reference.

Implementation

Future<CommandCompletion> setEventHandler(RuntimeEventHandler handler) =>
    _command((arena, completion) {
      final registrations = _NativeRegistrations(_callbackRoots);
      return registrations.run(
        () => raw.mln_runtime_set_event_handler(
          _handle.raw,
          registrations.add(
            _prepareRuntimeEventHandler(handler, registrations.roots),
          ),
          completion,
          nativeDiagnostic,
        ),
      );
    });