jqEventListener static method

String jqEventListener({
  1. required String selector,
  2. required String event,
  3. List<String> args = const [],
  4. required String body,
})

Build a jQuery event listener

selector is the selector of the element to listen to. The selector should be a jQuery selector without the paranthesis and the jQuery sign. 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 jqEventListener({
  required String selector,
  required String event,
  List<String> args = const [],
  required String body,
}) =>
    "\$($selector).on('$event', ${callbackClosure(args: args, body: body)});";