Skip to main content
Deno 2 is finally here πŸŽ‰οΈ
Learn more
Module

x/fresh/tests/deps.ts>Page#emulateMediaType

The next-gen web framework.
Extremely Popular
Go to Latest
method Page.prototype.emulateMediaType
Re-export
import { Page } from "https://deno.land/x/fresh@1.2.0/tests/deps.ts";

Examples

Example 1

await page.evaluate(() => matchMedia('screen').matches);
// β†’ true
await page.evaluate(() => matchMedia('print').matches);
// β†’ false

await page.emulateMediaType('print');
await page.evaluate(() => matchMedia('screen').matches);
// β†’ false
await page.evaluate(() => matchMedia('print').matches);
// β†’ true

await page.emulateMediaType(null);
await page.evaluate(() => matchMedia('screen').matches);
// β†’ true
await page.evaluate(() => matchMedia('print').matches);
// β†’ false

Parameters

optional
type: string
  • Changes the CSS media type of the page. The only allowed values are screen, print and null. Passing null disables CSS media emulation.

Returns

Promise<void>