Add .gitignore to exclude all node packages and lock files
This commit is contained in:
Generated
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
import { compose } from './compose';
|
||||
export const createFrame = async ({ div, width, height, logLevel, internalState, }) => {
|
||||
const canvas = new OffscreenCanvas(width, height);
|
||||
const context = canvas.getContext('2d');
|
||||
if (!context) {
|
||||
throw new Error('Could not get context');
|
||||
}
|
||||
await compose({
|
||||
element: div,
|
||||
context,
|
||||
logLevel,
|
||||
parentRect: new DOMRect(0, 0, width, height),
|
||||
internalState,
|
||||
onlyBackgroundClip: false,
|
||||
});
|
||||
return canvas;
|
||||
};
|
||||
export const takeScreenshot = async ({ div, width, height, imageFormat, logLevel, internalState, }) => {
|
||||
const frame = await createFrame({
|
||||
div,
|
||||
width,
|
||||
height,
|
||||
logLevel,
|
||||
internalState,
|
||||
});
|
||||
const imageData = await frame.convertToBlob({
|
||||
type: `image/${imageFormat}`,
|
||||
});
|
||||
return imageData;
|
||||
};
|
||||
Reference in New Issue
Block a user