Lynx

addCDPEventListener

Adds a listener for CDP Event messages.

This can be used with the invokeCDPFromSDK method to listen for CDP messages sent from DevTool.

Syntax

iOS

LynxBaseInspectorOwner.h
- (void)addCDPEventListener:(nonnull NSString *)name
               withListener:(nonnull id<CDPEventListener>)listener;

Android

LynxBaseInspectorOwner.java
void addCDPEventListener(final String name, final CDPEventListener listener);

Parameters

  • name: A unique identifier for the listener, used for subsequent removal.
  • listener: An object that implements CDPEventListener to receive Event messages.
Warning
  1. DevTool only holds a weak reference to CDPEventListener. Developers need to manage its lifecycle.
  2. Multiple listeners can be set by calling this method multiple times, but if a listener with the same name is set, the previous one will be overwritten.

Usage Example

Please refer to CDPEventListener.

Compatibility

LCD tables only load in the browser

Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.