channelDispacher function

Pointer<JSValue> channelDispacher(
  1. Pointer<JSContext> ctx,
  2. int type,
  3. Pointer<JSValue> argv
)

Implementation

Pointer<JSValue> channelDispacher(
  Pointer<JSContext> ctx,
  int type,
  Pointer<JSValue> argv,
) {
  final rt = type == JSChannelType.FREE_OBJECT
      ? ctx.cast<JSRuntime>()
      : jsGetRuntime(ctx);

  final runtimeOpaque = runtimeOpaques[rt];

  assert(
    runtimeOpaque != null,
    'The requested runtime opaque does not exist: $rt',
  );

  return runtimeOpaque!._channel(ctx, type, argv);
}