Initial commit

This commit is contained in:
Joe
2026-06-26 14:12:10 +02:00
commit 12518b259c
5258 changed files with 732924 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import type {Viewport} from '../common/Viewport.js';
import type {BrowsingContext} from './BrowsingContext.js';
/**
* @internal
*/
export class EmulationManager {
#browsingContext: BrowsingContext;
constructor(browsingContext: BrowsingContext) {
this.#browsingContext = browsingContext;
}
async emulateViewport(viewport: Viewport): Promise<void> {
await this.#browsingContext.connection.send('browsingContext.setViewport', {
context: this.#browsingContext.id,
viewport:
viewport.width && viewport.height
? {
width: viewport.width,
height: viewport.height,
}
: null,
devicePixelRatio: viewport.deviceScaleFactor
? viewport.deviceScaleFactor
: null,
});
}
}