Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vue/devtools-shared

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue/devtools-shared

> Internal utility types shared across @vue/devtools packages.

  • 7.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
475K
decreased by-40.06%
Maintainers
1
Weekly downloads
 
Created

What is @vue/devtools-shared?

@vue/devtools-shared is a package that provides shared utilities and components for Vue Devtools. It is used to build and extend the Vue Devtools, which are tools for debugging and profiling Vue.js applications.

What are @vue/devtools-shared's main functionalities?

Component Inspector

This feature allows you to inspect Vue components within the Devtools. The code sample demonstrates how to set up a custom plugin that logs the inspected component instance.

import { setupDevtoolsPlugin } from '@vue/devtools-shared';

setupDevtoolsPlugin({
  id: 'my-plugin',
  label: 'My Plugin',
  app: myVueApp
}, api => {
  api.on.inspectComponent((payload, ctx) => {
    console.log('Inspecting component:', payload.componentInstance);
  });
});

Timeline Events

This feature allows you to add custom events to the Vue Devtools timeline. The code sample shows how to create a new timeline layer and add an event to it.

import { setupDevtoolsPlugin } from '@vue/devtools-shared';

setupDevtoolsPlugin({
  id: 'my-plugin',
  label: 'My Plugin',
  app: myVueApp
}, api => {
  api.addTimelineLayer({
    id: 'my-timeline',
    label: 'My Timeline',
    color: 0xff0000
  });

  api.addTimelineEvent({
    layerId: 'my-timeline',
    event: {
      time: Date.now(),
      data: { message: 'Hello from my plugin!' }
    }
  });
});

Custom Inspector

This feature allows you to create custom inspectors in the Vue Devtools. The code sample demonstrates how to add a new inspector and define its tree and state.

import { setupDevtoolsPlugin } from '@vue/devtools-shared';

setupDevtoolsPlugin({
  id: 'my-plugin',
  label: 'My Plugin',
  app: myVueApp
}, api => {
  api.addInspector({
    id: 'my-inspector',
    label: 'My Inspector',
    icon: 'search'
  });

  api.on.getInspectorTree((payload, ctx) => {
    if (payload.inspectorId === 'my-inspector') {
      payload.rootNodes = [{ id: 'root', label: 'Root Node' }];
    }
  });

  api.on.getInspectorState((payload, ctx) => {
    if (payload.inspectorId === 'my-inspector') {
      payload.state = { 'Root Node': { message: 'Hello from my inspector!' } };
    }
  });
});

Other packages similar to @vue/devtools-shared

FAQs

Package last updated on 29 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc