Some useful vConsole properties and methods are available for plugin development.
The current version of vConsole.
- Readonly
- Type: string
Example:
vConsole.version // => "3.0.0"
A configuration object.
- Writable
- Type: 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. |
maxLogNumber | Number | true | 1000 | Overflow logs will be removed from log tabs. |
Example:
// get
vConsole.option // => {...}
// set
vConsole.setOption('maxLogNumber', 5000);
// or:
vConsole.setOption({maxLogNumber: 5000});
The actived tab's plugin id.
- Readonly
- Type: string
- Default: "default"
Example:
vConsole.activedTab // => "system"
A list of installed tabs' plugin id.
- Readonly
- Type: array(string)
Example:
vConsole.tabList // => ["default", "system"]
vConsole's HTML element.
- Type: HTMLDivElement
Update vConsole.option
.
- (required) keyOrObj: The key of option, or a key-value object.
- (optional) value: The value of an option.
- None
vConsole.setOption('maxLogNumber', 5000);
// or:
vConsole.setOption({maxLogNumber: 5000});
Destroy an vConsole instance object and remove vConsole panel from document.
- None
- None
var vConsole = new VConsole();
// ... do something
vConsole.destroy();
Add a new plugin to vConsole. Duplicate plugin will be ignored.
- (required) plugin: An VConsolePlugin object.
- Boolean:
true
for success,false
for failure.
var myPlugin = new VConsolePlugin('my_plugin', 'My Plugin');
vConsole.addPlugin(myPlugin);
Remove an existing plugin.
- (required) pluginID: A string, plugin's id.
- Boolean:
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.
- (required) pluginID: A string, tab's plugin id.
- None
vConsole.showTab("system"); // show System tab
Show vConsole panel. This method will trigger plugin event showConsole
.
- None
- None
vConsole.show();
Hide vConsole panel. This method will trigger plugin event hideConsole
.
- None
- None
vConsole.hide();