Some useful vConsole properties and methods are available for plugin development.
The current version of vConsole.
Example:
vConsole.version // => "3.4.1"
A configuration object.
Key | Type | Optional | Default value | Description |
---|---|---|---|---|
defaultPlugins | Array | true | ['system', 'network', 'element', 'storage'] | Listed built-in plugins will be inited and loaded into vConsole. |
onReady | Function | true | Trigger after vConsole is inited and default plugins is loaded. | |
onClearLog | Function | true | Trigger after click "Clear" button in Log and System panel. | |
maxLogNumber | Number | true | 1000 | Overflow logs will be removed from log tabs. |
disableLogScrolling | Boolean | true | If false , panel will not scroll to bottom while printing new logs. |
|
theme | String | true | 'light' | Theme mode, 'light' |
Example:
// get
vConsole.option // => {...}
// set
vConsole.setOption('maxLogNumber', 5000);
// or:
vConsole.setOption({maxLogNumber: 5000});
The actived tab's plugin id.
Example:
vConsole.activedTab // => "system"
A list of installed tabs' plugin id.
Example:
vConsole.tabList // => ["default", "system"]
vConsole's HTML element.
Update vConsole.option
.
vConsole.setOption('maxLogNumber', 5000);
// or:
vConsole.setOption({maxLogNumber: 5000});
Update the position of switch button.
vConsole.setSwitchPosition(20, 20);
Destroy an vConsole instance object and remove vConsole panel from document.
var vConsole = new VConsole();
// ... do something
vConsole.destroy();
Add a new plugin to vConsole. Duplicate plugin will be ignored.
true
for success, false
for failure.var myPlugin = new VConsolePlugin('my_plugin', 'My Plugin');
vConsole.addPlugin(myPlugin);
Remove an existing plugin.
true
for success, false
for failure.vConsole.removePlugin('my_plugin');
Activating a tab according to its plugin id.
Plugin event hide
will be triggered for previous actived tab, and show
for current actived tab.
vConsole.showTab("system"); // show System tab
Show vConsole panel. This method will trigger plugin event showConsole
.
vConsole.show();
Hide vConsole panel. This method will trigger plugin event hideConsole
.
vConsole.hide();
Show vConsole switch button.
vConsole.showSwitch();
Hide vConsole switch button.
After the button is hidden, the user will not be able to call vConsole manually. The button or panel must be shown programmably via vConsole.showSwitch()
or vConsole.show()
.
vConsole.hideSwitch();