Skip to content

Commit

Permalink
Update types
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore committed Mar 12, 2024
1 parent acf95d0 commit c90d76e
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 2 deletions.
60 changes: 60 additions & 0 deletions types/core/engine/command/bidi.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* Manages interactions using Bidi. At the moment this only works for Firefox
* but Chrome and maybe other browsers will support it in the future.
* @class
* @hideconstructor
* @see https://w3c.github.io/webdriver-bidi/
*/
export class Bidi {
constructor(engineDelegate: any, browserName: any);
/**
* @private
*/
private engineDelegate;
/**
* @private
*/
private browserName;
/**
* Add a fanction that will get the events that you subscribes.
* @async
* @param {Function} f - The callback function to handle incoming messages. The function will get an event passed on to it. Remember to subscribe to the event.
* @throws {Error} Throws an error if the method is called in a browser other than Firefox.
*/
onMessage(f: Function): Promise<void>;
/**
* Retrieves the raw client for Bidi.
* @async
* @example const bidi = await commands.bidi.getRawClient();
* @returns {Promise<Object>} A promise that resolves to the Bidi client.
* @throws {Error} Throws an error if the browser is not supported.
*/
getRawClient(): Promise<any>;
/**
* Subscribe to a event.
* @async
* @param {string} messageType The type of message to subscribe to.
* @returns {Promise<Object>} A promise that resolves you have subscribed.
* @throws {Error} Throws an error if the method is called in a browser other than Firefox.
*/
subscribe(messageType: string): Promise<any>;
/**
* Unsubscribe to an event.
* @async
* @param {string} messageType The type of message to unsubscribe to.
* @returns {Promise<Object>} A promise that resolves you have unsubscribed.
* @throws {Error} Throws an error if the method is called in a browser other than Firefox.
*/
unsubscribe(messageType: string): Promise<any>;
/**
* Sends a command using Bidi.
*
* @async
* @example await commands.bidi.send({});
* @param {Object} parameters - The paramaters for the command.
* @throws {Error} Throws an error if the browser is not supported or if the command fails.
* @returns {Promise<Object>} A promise that resolves when the command has been sent.
*/
send(parameters: any): Promise<any>;
}
//# sourceMappingURL=bidi.d.ts.map
1 change: 1 addition & 0 deletions types/core/engine/command/bidi.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions types/core/engine/commands.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ export class Commands {
* @type {ChromeDevelopmentToolsProtocol}
*/
cdp: ChromeDevelopmentToolsProtocol;
/**
*
* Use WebDriver Bidi. Availible in Firefox and in the future more browsers.
* @type {Bidi}
*/
bidi: Bidi;
/**
* Provides commands for interacting with an Android device.
* @type {AndroidCommand}
Expand Down Expand Up @@ -153,6 +159,7 @@ import { Cache } from './command/cache.js';
import { Meta } from './command/meta.js';
import { Screenshot } from './command/screenshot.js';
import { ChromeDevelopmentToolsProtocol } from './command/chromeDevToolsProtocol.js';
import { Bidi } from './command/bidi.js';
import { AndroidCommand } from './command/android.js';
import { Debug } from './command/debug.js';
import { Select } from './command/select.js';
Expand Down
2 changes: 1 addition & 1 deletion types/core/engine/commands.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion types/support/getViewPort.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c90d76e

Please sign in to comment.