Contents

CommandLine

Provides access to the application command line switches and their values.

import { commandLine } from '@mobrowser/api';

Example 

import { commandLine } from '@mobrowser/api';

if (commandLine.hasSwitch('disable-gpu')) {
  console.log('GPU is disabled')
}
const value = commandLine.getSwitchValue('custom-option')

Methods 

hasSwitch() 

hasSwitch(switchName: string): boolean;

Checks if a switch with the given name exists.

ParameterTypeDescription
switchNamestringThe name of the switch to check for.

Return value 

True if the switch exists, false otherwise.

Example 

import { commandLine } from '@mobrowser/api';

if (commandLine.hasSwitch('disable-gpu')) {
  console.log('GPU is disabled')
}

getSwitchValue() 

getSwitchValue(switchName: string): string;

Gets the value of a switch with the given name.

ParameterTypeDescription
switchNamestringThe name of the switch to get the value for.

Return value 

The value of the switch, or an empty string if the switch does not exist or has no value.