new Commands(config [, opts])
Creates commands instance.
Parameters:
| Name | Type | Argument | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
object | Commands config. |
|||||||||||||||||||||||||||||||
opts |
object |
<optional> |
Commands options. Properties
|
- Source:
Methods
-
<protected> _checkProxy()
-
Helper to check whether any proxy is launched.
- Source:
Returns:
trueif proxy exists and launched,falseotherwise.- Type
- boolean
-
<protected> _chromeUrl()
-
Helper to get URL to open in chrome browser. If HTTP proxy is launched, it will return proxy URL.
- Source:
Returns:
URL to open chrome.
- Type
- string
-
<protected> _isChromeLaunched()
-
Helper to define whether chrome is launched.
- Source:
Returns:
- Type
- boolean
-
<protected> _isGlobalProxyLaunched()
-
Helper to define whether global proxy is running.
- Source:
Returns:
- Type
- boolean
-
<protected> _isHttpProxyLaunched()
-
Helper to define whether http proxy is running.
- Source:
Returns:
- Type
- boolean
-
<async> clearProxyCache()
-
Command to clear proxy cache.
- Source:
Returns:
truewhen cache will be cleared.- Type
- Promise.<boolean>
-
<async> closeChrome()
-
Command to close chrome browser.
- Source:
Returns:
trueif chrome browser was closed.falseif command can't be executed. Causes to not close chrome browser:- Chrome browser isn't launched yet.
- Type
- Promise.<boolean>
-
<async> disableProxyCache()
-
Command to disable proxy cache.
- Source:
Returns:
trueif proxy cache wasn't disabled.falseif command can't be executed. Causes to not disable proxy cache:- HTTP proxy isn't launched.
- Type
- Promise.<boolean>
-
<async> enableProxyCache()
-
Command to enable proxy cache.
- Source:
Returns:
trueif proxy cache wasn't enabled.falseif command can't be executed. Causes to not enable proxy cache:- HTTP proxy isn't launched.
- Type
- Promise.<boolean>
-
<async> launchChrome( [opts])
-
Command to launch chrome browser.
Parameters:
Name Type Argument Description optsobject <optional>
Options.
Properties
Name Type Argument Default Description chromeOptsArray.<string> <optional>
[] Chrome options list.
- Source:
Returns:
trueif chrome browser was launched.falseif command can't be executed. Causes to not launch chrome browser:- HTTP proxy isn't launched yet.
- Chrome browser is launched already.
- Type
- Promise.<boolean>
-
<async> launchGlobalProxy()
-
Command to launch global transparent proxy.
- Source:
Returns:
trueif global transparent proxy isn't launched.falseif command can't be executed. Causes to not launch global transparent proxy:- Global transparent proxy is launched already.
- Type
- Promise.<boolean>
-
<async> launchHttpProxy()
-
Command to launch HTTP proxy.
- Source:
Returns:
trueif HTTP proxy was launched.falseif command can't be executed. Causes to not launch HTTP proxy:- HTTP proxy is launched already.
- Proxied URL isn't specified.
- Type
- Promise.<boolean>
-
<async> resetProxySpeed()
-
Command to reset proxy speed.
- Source:
Returns:
trueif proxy speed was reset.falseif command can't be executed. Causes to not reset proxy speed:- HTTP proxy isn't launched.
- Type
- Promise.<boolean>
-
<async> restartChrome()
-
Command to restart chrome browser.
- Source:
Returns:
trueif chrome browser was restarted.falseif command can't be executed. Causes to not restart chrome browser are the the same as for command to launch chrome browser.- Type
- Promise.<boolean>
-
<async> restartGlobalProxy()
-
Command to restart global transparent proxy.
- Source:
Returns:
trueif global transparent proxy was restarted.falseif command can't be executed. Causes to not restart global transparent proxy are the same as for command to launch global transparent proxy.- Type
- Promise.<boolean>
-
<async> restartHttpProxy()
-
Command to restart HTTP proxy.
- Source:
Returns:
trueif HTTP proxy was restarted.falseif command can't be executed. Causes to not restart HTTP proxy are the same as for command to launch HTTP proxy.- Type
- Promise.<boolean>
-
<async> setProxiedUrl()
-
Command to set proxied URL.
- Source:
Returns:
- Type
- Promise
-
<async> setProxySpeed(speed)
-
Command to set proxy speed.
Parameters:
Name Type Description speednumber Proxy speed, kb/s.
Properties
Name Type Argument Description reqnumber <optional>
<nullable>
Requests speed, kb/s.
resnumber <optional>
<nullable>
Responses speed, kb/s.
- Source:
Returns:
trueif proxy speed was set.falseif command can't be executed. Causes to not set proxy speed:- HTTP proxy isn't launched.
- Type
- Promise.<boolean>
-
<async> stopGlobalProxy( [opts])
-
Command to stop global transparent proxy.
Parameters:
Name Type Argument Description optsobject <optional>
Options.
Properties
Name Type Argument Default Description restartChromeboolean <optional>
true Restart chrome.
- Source:
Returns:
trueif global transparent proxy was stopped.falseif command can't be executed. Causes to not stop global transparent proxy:- Global transparent proxy isn't launched yet.
- Type
- Promise.<boolean>
-
<async> stopHttpProxy( [opts])
-
Command to stop HTTP proxy.
Parameters:
Name Type Argument Description optsobject <optional>
Options.
Properties
Name Type Argument Default Description restartChromeboolean <optional>
true Restart chrome.
- Source:
Returns:
trueif HTTP proxy was stopped.falseif command can't be executed. Causes to not stop HTTP proxy:- HTTP proxy isn't launched yet.
- Type
- Promise.<boolean>