MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / removeCallback

Method removeCallback

javascript/selenium-webdriver/bidi/index.js:461–484  ·  view source on GitHub ↗

* Removes exactly the callback registered under `subscriptionId` (as * returned by addCallback). A no-op if already removed — including * once the connection is closed, since _failPending() has already cleaned * up local state at that point (and there is no remote end left to reach:

(subscriptionId)

Source from the content-addressed store, hash-verified

459 * @returns {Promise<void>}
460 */
461 async removeCallback(subscriptionId) {
462 const entry = this._callbacks.get(subscriptionId)
463 if (entry === undefined) {
464 return
465 }
466
467 if (entry.removing === undefined) {
468 entry.removing = (async () => {
469 const response = await this.send({
470 method: 'session.unsubscribe',
471 params: { subscriptions: [subscriptionId] },
472 })
473 if (response?.error !== undefined) {
474 throw new Error(`${response.error}: ${response.message}`)
475 }
476 this._callbacks.delete(subscriptionId)
477 this.off(entry.method, entry.handler)
478 })().finally(() => {
479 entry.removing = undefined
480 })
481 }
482
483 return entry.removing
484 }
485
486 /**
487 * Close ws connection.

Callers 5

addCallbackMethod · 0.95
index_test.jsFile · 0.45

Calls 3

sendMethod · 0.95
getMethod · 0.65
deleteMethod · 0.45

Tested by

no test coverage detected