call method
Implementation
@override
Object? call(Interpreter interpreter, List<Object?> arguments,
Map<Symbol, Object?> namedArguments) {
var name = namedArguments[const Symbol('name')];
if (name == null) {
throw "parameter name is required";
}
var onMessageReceived = namedArguments[const Symbol('onMessageReceived')];
if (onMessageReceived == null) {
throw "parameter onMessageReceived is required";
}
return JavascriptChannel(
name: name as String,
onMessageReceived: (JavascriptMessage message) {
var msgIns = JavascriptMessageIns(message.message);
(onMessageReceived as LoxFunction).call(interpreter, [msgIns], {});
});
}