-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add a mobile endpoint to retrieve screenshots for each macOS di…
…splay (#120)
- Loading branch information
1 parent
bbd1c66
commit c1963d9
Showing
5 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const commands = {}; | ||
|
||
/** | ||
* @typedef {Object} ScreenshotsInfo | ||
* | ||
* A dictionary where each key contains a unique display identifier | ||
* and values are dictionaries with following items: | ||
* - id: Display identifier | ||
* - isMain: Whether this display is the main one | ||
* - payload: The actual PNG screenshot data encoded to base64 string | ||
*/ | ||
|
||
/** | ||
* @typedef {Object} ScreenshotsOpts | ||
* @property {number?} displayId macOS display identifier to take a screenshot for. | ||
* If not provided then screenshots of all displays are going to be returned. | ||
* If no matches were found then an error is thrown. | ||
*/ | ||
|
||
/** | ||
* Retrieves screenshots of each display available to macOS | ||
* | ||
* @param {ScreenshotsOpts} opts | ||
* @returns {ScreenshotsInfo} | ||
*/ | ||
commands.macosScreenshots = async function macosScreenshots (opts = {}) { | ||
const {displayId} = opts; | ||
return await this.wda.proxy.command('/wda/screenshots', 'POST', {displayId}); | ||
}; | ||
|
||
export { commands }; | ||
export default commands; |