getEventListeners method

Future<List<EventListener>> getEventListeners(
  1. RemoteObjectId objectId, {
  2. int? depth,
  3. bool? pierce,
})

Returns event listeners of the given object. objectId Identifier of the object to return listeners for. depth The maximum depth at which Node children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0. pierce Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false). Reports listeners for all contexts if pierce is enabled. Returns: Array of relevant listeners.

Implementation

Future<List<EventListener>> getEventListeners(
  runtime.RemoteObjectId objectId, {
  int? depth,
  bool? pierce,
}) async {
  var result = await _client.send('DOMDebugger.getEventListeners', {
    'objectId': objectId,
    if (depth != null) 'depth': depth,
    if (pierce != null) 'pierce': pierce,
  });
  return (result['listeners'] as List)
      .map((e) => EventListener.fromJson(e as Map<String, dynamic>))
      .toList();
}