UNPKG

@xata.io/screenshot

Version:

A zero-dependency browser-native way to take screenshots powered by the native web MediaDevices API.

31 lines (30 loc) 1.09 kB
declare type Options = { /** * The quality between 0-1 of your final image. 1 is uncompressed, 0 is lowest quality. * @default 0.7 */ quality?: number; /** * What should we do when capture starts? This is usually a good time to `hideModal()` or similar. */ onCaptureStart?: () => Promise<void>; /** * What should we do when capture ends? This is usually a good time to clean stuff up. */ onCaptureEnd?: () => Promise<void>; /** * What format of image would you like? * @default image/jpeg */ type?: "image/jpeg" | "image/png"; /** * Why not play a little audio camera click sound effect when your screenshot is being taken? * @optional */ soundEffectUrl?: string; }; /** * Takes a screenshot of the current page using a the native browser [`MediaDevices`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia) API. */ export declare const takeScreenshot: ({ onCaptureEnd, onCaptureStart, quality, type, soundEffectUrl, }?: Options) => Promise<string>; export {};