The $TS.screen()
function takes a URL or domain (act.com
) and an object with properties such as zoom level, width, and crop coordinates to capture a screenshot of a webpage. This function can be customized to capture a specific area of the webpage based on the provided parameters.
$TS.screen('act.com', {zoom: .5, width: 680, 'crop-y': 400, 'crop-h': 400});
// Define the constants for the screen dimensions and zoom level
const SCREEN_WIDTH = 680;
const SCREEN_HEIGHT = 400;
const ZOOM_LEVEL = 0.5;
const CROP_Y = 400;
const CROP_HEIGHT = 400;
// Define the API endpoint for the screen operation
const SCREEN_API_ENDPOINT = 'act.com';
// Create a data object to hold the screen operation settings
const screenSettings: ScreenSettings = {
endpoint: SCREEN_API_ENDPOINT,
zoom: ZOOM_LEVEL,
width: SCREEN_WIDTH,
cropY: CROP_Y,
cropHeight: CROP_HEIGHT,
};
// Call the screen operation API using the settings object
void TS.screen(SCREEN_API_ENDPOINT, screenSettings);
// TODO: Consider implementing input validation for the screenSettings object
// TODO: Consider adding error handling for API calls
Function Call: $TS.screen()
act.com
: URL or domain of the website to be screened.zoom
: Zoom level of the webpage (0-1 range).width
: Width of the screenshot (in pixels).crop-y
and crop-h
: Cropped area of the screenshot (y and height coordinates).