The $TS.screen()
function opens a new screen in the TS application, navigating to the specified URL (act.com/au/products
) with customizable options such as zoom level, width, and cropping height.
$TS.screen('act.com/au/products', {zoom: .5, width: 680, 'crop-h': 400});
typescript
interface BrowserConfig {
url: string;
zoom: number;
width: number;
height?: number;
}
class Browser {
private url: string;
private config: BrowserConfig;
constructor(url: string, config: BrowserConfig = {}) {
this.url = url;
this.config = {...config, height: config['crop-h'] };
}
static openBrowser(config: BrowserConfig): void {
// TODO: Implement browser opening logic
console.log(`Opening browser with config: ${JSON.stringify(config)}`);
}
printBrowserCommand(): void {
const { url, config } = this;
const { zoom, width, height } = config;
// Ensure zoom is within valid range
const validZoom = Math.min(Math.max(zoom, 0.1), 2);
console.log(`$TS.screen('${url}', { zoom: ${validZoom}, width: ${width}, height: ${height} })`);
}
}
// Usage
const browserConfig: BrowserConfig = {
url: 'act.com/au/products',
zoom: 0.5,
width: 680,
'crop-h': 400,
};
const browser = new Browser('act.com/au/products', browserConfig);
browser.printBrowserCommand();
Browser.openBrowser(browserConfig);
$TS.screen()
Functionzoom:.5
: Sets the initial zoom level of the new screen to 50%.width: 680
: Sets the initial width of the new screen to 680 pixels.crop-h: 400
: Sets the cropping height of the new screen to 400 pixels.This code opens a new screen in the TS application with the specified URL (act.com/au/products
), zoom level, width, and cropping height.