Top Related Projects
Quick Overview
vConsole is a lightweight, extendable debugging console for mobile web pages. It allows developers to inspect network requests, view console logs, and interact with the page's JavaScript environment directly from the web browser.
Pros
- Lightweight and Efficient: vConsole is designed to be lightweight, with a small footprint and minimal impact on page performance.
- Extendable and Customizable: The console can be extended with custom plugins, allowing developers to add new functionality and tailor the tool to their specific needs.
- Cross-browser Compatibility: vConsole works across a wide range of mobile browsers, including iOS and Android.
- Easy to Integrate: The console can be easily integrated into existing web projects, with a simple installation process and straightforward API.
Cons
- Limited Functionality: While vConsole provides a range of useful debugging features, it may not offer the same level of advanced functionality as some desktop-based debugging tools.
- Mobile-only Focus: vConsole is primarily designed for mobile web development, so it may not be the best choice for developers working on desktop-focused projects.
- Potential Security Concerns: As with any debugging tool, there may be potential security risks if vConsole is not properly configured or used in a production environment.
- Dependency on JavaScript: vConsole relies on JavaScript to function, which means it may not be suitable for projects that require a more lightweight or non-JavaScript-based approach.
Code Examples
Here are a few examples of how to use vConsole:
- Initializing the Console:
// Import the vConsole library
import VConsole from 'vconsole';
// Create a new instance of vConsole
const vConsole = new VConsole();
- Logging Messages:
// Log a message to the console
console.log('This is a log message');
// Log an error message
console.error('This is an error message');
// Log a warning message
console.warn('This is a warning message');
- Interacting with the Page:
// Get a reference to an element on the page
const element = document.getElementById('my-element');
// Interact with the element
element.addEventListener('click', () => {
console.log('Element was clicked!');
});
- Adding Custom Plugins:
// Create a new plugin
class MyPlugin extends VConsole.Plugin {
constructor() {
super('my-plugin', 'My Plugin');
}
// Implement the plugin's functionality
onInit() {
console.log('My plugin has been initialized!');
}
}
// Register the plugin with vConsole
vConsole.addPlugin(new MyPlugin());
Getting Started
To get started with vConsole, follow these steps:
- Install the library using npm or yarn:
npm install vconsole
- Import the library and create a new instance of the
VConsole
class:
import VConsole from 'vconsole';
const vConsole = new VConsole();
- (Optional) Add custom plugins to extend the functionality of the console:
class MyPlugin extends VConsole.Plugin {
constructor() {
super('my-plugin', 'My Plugin');
}
onInit() {
console.log('My plugin has been initialized!');
}
}
vConsole.addPlugin(new MyPlugin());
- Use the console to debug your application, logging messages, inspecting the DOM, and interacting with the page's JavaScript environment.
That's it! With these simple steps, you can start using vConsole to improve your mobile web development workflow.
Competitor Comparisons
Console for mobile browsers
Pros of eruda
- More comprehensive feature set, including network request monitoring and timing analysis
- Highly customizable with plugin system for extending functionality
- Smaller file size, leading to faster load times
Cons of eruda
- Less frequent updates and maintenance compared to vConsole
- Steeper learning curve due to more advanced features
Code Comparison
eruda:
eruda.init();
eruda.add(new eruda.Timing());
eruda.show();
vConsole:
var vConsole = new VConsole();
vConsole.showSwitch();
Both libraries offer easy initialization, but eruda provides more options for customization and adding plugins. vConsole's setup is simpler, which may be preferable for basic debugging needs.
eruda offers a more feature-rich debugging experience with advanced tools like timing analysis and network monitoring. However, this comes at the cost of a steeper learning curve. vConsole, while less comprehensive, is easier to use and receives more frequent updates.
The choice between the two depends on the specific debugging requirements of the project and the developer's familiarity with the tools.
VasSonic is a lightweight and high-performance Hybrid framework developed by tencent VAS team, which is intended to speed up the first screen of websites working on Android and iOS platform.
Pros of VasSonic
- Focuses on optimizing web page loading speed, especially for mobile devices
- Provides a hybrid framework for both Android and iOS platforms
- Implements pre-loading and parallel loading techniques for faster content delivery
Cons of VasSonic
- More complex implementation compared to vConsole
- Requires integration with both client-side and server-side code
- May have a steeper learning curve for developers new to hybrid frameworks
Code Comparison
VasSonic (Android):
SonicSession session = SonicEngine.getInstance().createSession(url, new SonicSessionConfig.Builder().build());
if (null != session) {
session.bindClient(new SonicSessionClientImpl());
}
vConsole:
import VConsole from 'vconsole';
const vConsole = new VConsole();
// or init with options
const vConsole = new VConsole({ theme: 'dark' });
While VasSonic focuses on optimizing web page loading speed through a hybrid framework, vConsole is primarily a lightweight debugging tool for mobile web pages. VasSonic requires more integration work but can significantly improve performance, especially for complex web applications. On the other hand, vConsole is easier to implement and provides immediate debugging capabilities without extensive setup.
Web Components Framework - Web组件框架
Pros of omi
- Offers a more comprehensive web development framework with virtual DOM and JSX support
- Provides better performance optimization for large-scale applications
- Supports TypeScript out of the box, enhancing developer productivity
Cons of omi
- Steeper learning curve compared to vConsole's simplicity
- Less focused on debugging and may require additional tools for console-like functionality
- Larger bundle size due to its full-featured nature
Code Comparison
omi:
import { define, WeElement, render } from 'omi'
define('my-counter', class extends WeElement {
static data = { count: 0 }
render(props, data) {
return <div>{data.count}</div>
}
})
render(<my-counter />, 'body')
vConsole:
import VConsole from 'vconsole';
const vConsole = new VConsole();
console.log('Hello world');
vConsole.showSwitch();
While omi is a full-fledged web development framework, vConsole focuses on providing a lightweight, mobile-friendly debugging console. omi is better suited for building complex web applications, while vConsole excels at adding debugging capabilities to existing projects, especially on mobile devices.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
English | ç®ä½ä¸æ
vConsole
A lightweight, extendable front-end developer tool for mobile web page.
vConsole is framework-free, you can use it in Vue or React or any other framework application.
Now vConsole is the official debugging tool for WeChat Miniprograms.
Features
- Logs:
console.log|info|error|...
- Network:
XMLHttpRequest
,Fetch
,sendBeacon
- Element: HTML elements tree
- Storage:
Cookies
,LocalStorage
,SessionStorage
- Execute JS command manually
- Custom plugins
For details, please see the screenshots below.
Release Notes
Detailed release notes for each version are available on Changelog.
Guide
See Tutorial for more usage details.
For installation, there are 2 primary ways of adding vConsole to a project:
Method 1: Using npm (Recommended)
$ npm install vconsole
import VConsole from 'vconsole';
const vConsole = new VConsole();
// or init with options
const vConsole = new VConsole({ theme: 'dark' });
// call `console` methods as usual
console.log('Hello world');
// remove it when you finish debugging
vConsole.destroy();
Method 2: Using CDN in HTML:
<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
<script>
// VConsole will be exported to `window.VConsole` by default.
var vConsole = new window.VConsole();
</script>
Available CDN:
- https://unpkg.com/vconsole@latest/dist/vconsole.min.js
- https://cdn.jsdelivr.net/npm/vconsole@latest/dist/vconsole.min.js
Preview
http://wechatfe.github.io/vconsole/demo.html
Screenshots
Overview
Light theme
Dark theme
Log Panel
Log styling
Command line
System Panel
Performance info
Output logs to different panel
console.log('output to Log panel.')
console.log('[system]', 'output to System panel.')
Network Panel
Request details
Element Panel
Realtime HTML elements structure
Storage Panel
Add, edit, delete or copy Cookies / LocalStorage / SessionStorage
Documentation
vConsole:
Custom Plugin:
Third-party Plugins
- vConsole-sources
- vconsole-webpack-plugin
- vconsole-stats-plugin
- vconsole-vue-devtools-plugin
- vconsole-outputlog-plugin
- vite-plugin-vconsole
Feedback
QQ Group: 497430533
License
Top Related Projects
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot