onGet method

OnListener? onGet(
  1. String typename
)

Returns the currently-assigned listener for the specified event typename on the first (non-null) selected element, if any.

If multiple typenames are specified, the first matching listener is returned.

Implementation

OnListener? onGet(String typename) {
  var typenames = parseTypenames(typename);

  var on = (node() as JSObject?)?["__on"] as JSArray<JSObject>?;
  if (on != null) {
    for (var j = 0, m = (on["length"] as JSNumber).toDartInt; j < m; ++j) {
      final o = on[j.toString()] as JSObject;
      for (final t in typenames) {
        if (t["type"]!.toJS == o["type"] && t["name"]!.toJS == o["name"]) {
          return (o["value"] as JSBoxedDartObject).toDart as OnListener;
        }
      }
    }
  }
  return null;
}