Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions java/src/org/openqa/selenium/bidi/BiDi.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import java.io.Closeable;
import java.time.Duration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -117,18 +116,6 @@ public <X> String addListener(
return subscriptionId;
}

<X> String addListener(Event<X> event, Consumer<X> handler, SubscriptionScope scope) {
Require.nonNull("Event to listen for", event);
Require.nonNull("Handler to call", handler);
Require.nonNull("Subscription scope", scope);

Map<String, Object> params = new HashMap<>(scope.toMap());
params.put("events", List.of(event.getMethod()));
String subscriptionId = subscribe(params);
connection.addListener(subscriptionId, event, handler);
return subscriptionId;
}
Comment thread
pujagani marked this conversation as resolved.

// The subscription id returned by the browser is the sole identifier we need to unsubscribe
// later: it is unique regardless of whether the subscription was scoped to events, contexts, or
// user contexts, so there is no need to separately track how a listener was subscribed.
Expand Down
4 changes: 0 additions & 4 deletions java/src/org/openqa/selenium/bidi/Handle.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ <X> String subscribe(Event<X> event, Consumer<X> handler) {
return bidi.addListener(event, handler);
}

<X> String subscribe(Event<X> event, Consumer<X> handler, SubscriptionScope scope) {
return bidi.addListener(event, handler, scope);
}

void unsubscribe(String subscriptionId) {
bidi.removeListener(subscriptionId);
}
Expand Down
22 changes: 15 additions & 7 deletions java/src/org/openqa/selenium/bidi/Module.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,24 @@ protected final <X> X send(Command<X> command) {
return handle.send(command);
}

protected final <X> String subscribe(Event<X> event, Consumer<X> handler) {
/**
* Subscribes to a BiDi event, globally across all browsing contexts.
*
* @param event the event to subscribe to
* @param handler invoked with the event's parameters each time it fires
* @param <X> the event's parameter type
* @return a subscription id that can be passed to {@link #unsubscribe(String)}
*/
public final <X> String subscribe(Event<X> event, Consumer<X> handler) {
return handle.subscribe(event, handler);
}
Comment thread
qodo-code-review[bot] marked this conversation as resolved.

protected final <X> String subscribe(
Event<X> event, Consumer<X> handler, SubscriptionScope scope) {
return handle.subscribe(event, handler, scope);
}

protected final void unsubscribe(String subscriptionId) {
/**
* Cancels a previously registered event subscription.
*
* @param subscriptionId a subscription id previously returned by {@link #subscribe}
*/
public final void unsubscribe(String subscriptionId) {
handle.unsubscribe(subscriptionId);
}
}
74 changes: 0 additions & 74 deletions java/src/org/openqa/selenium/bidi/SubscriptionScope.java

This file was deleted.

Loading