Skip to content

Commit

Permalink
鉁╢eat: you can now resize getSnapshot #3032
Browse files Browse the repository at this point in the history
  • Loading branch information
smashah committed Feb 13, 2023
1 parent 4567de3 commit 40d832f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/api/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2120,9 +2120,13 @@ public async testCallback(callbackToTest: SimpleListener, testData: any) : Prom

/**
* Returns a PNG DataURL screenshot of the session
* @param chatId Chat ID to open before taking a snapshot
* @param width Width of the viewport for the snapshot. Height also required if you want to resize.
* @param height Height of the viewport for the snapshot. Width also required if you want to resize.
* @returns `Promise<DataURL>`
*/
public async getSnapshot(chatId?: ChatId) : Promise<DataURL> {
public async getSnapshot(chatId ?: ChatId, width ?: number, height ?: number) : Promise<DataURL> {
if(width && height) await this.resizePage(width,height)
const snapshotElement = chatId ? (await this._page.evaluateHandle(
({ chatId }) => WAPI.getSnapshotElement(chatId),
{ chatId }
Expand Down

0 comments on commit 40d832f

Please sign in to comment.