eventListener static method
Build a javascript event listener.
selector
is the selector of the element to listen to. Defaults to document
.
event
is the javascript event to listen to.
args
are the parameters accepted by the closure.
body
is the code that will be executed when the event is triggered.
Implementation
static String eventListener({
String selector = "document",
required String event,
List<String> args = const [],
required String body,
}) =>
"$selector.addEventListener('$event', ${callbackClosure(args: args, body: body)});";