Sha256: 4738291c58e80324da023be36d76484d53f5e7348c1c14c54510ba5f2d99ccee
Contents?: true
Size: 1.22 KB
Versions: 6
Compression:
Stored size: 1.22 KB
Contents
export class EmulationManager { constructor(client) { this._emulatingMobile = false; this._hasTouch = false; this._client = client; } async emulateViewport(viewport) { const mobile = viewport.isMobile || false; const width = viewport.width; const height = viewport.height; const deviceScaleFactor = viewport.deviceScaleFactor || 1; const screenOrientation = viewport.isLandscape ? { angle: 90, type: 'landscapePrimary' } : { angle: 0, type: 'portraitPrimary' }; const hasTouch = viewport.hasTouch || false; await Promise.all([ this._client.send('Emulation.setDeviceMetricsOverride', { mobile, width, height, deviceScaleFactor, screenOrientation, }), this._client.send('Emulation.setTouchEmulationEnabled', { enabled: hasTouch, }), ]); const reloadNeeded = this._emulatingMobile !== mobile || this._hasTouch !== hasTouch; this._emulatingMobile = mobile; this._hasTouch = hasTouch; return reloadNeeded; } } //# sourceMappingURL=EmulationManager.js.map
Version data entries
6 entries across 6 versions & 1 rubygems