Socket
Socket
Sign inDemoInstall

@vue/devtools-api

Package Overview
Dependencies
Maintainers
5
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue/devtools-api

Interact with the Vue devtools from the page


Version published
Weekly downloads
2.5M
increased by6.54%
Maintainers
5
Weekly downloads
 
Created

What is @vue/devtools-api?

@vue/devtools-api is a library that provides an API for Vue.js developers to create custom devtools extensions. It allows developers to hook into the Vue.js devtools and add custom inspection, logging, and debugging capabilities for their Vue.js applications.

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

Custom Inspector

This feature allows you to create a custom inspector in the Vue Devtools. The code sample demonstrates how to set up a custom inspector with a root node and some example state.

const { setupDevtoolsPlugin } = require('@vue/devtools-api');

setupDevtoolsPlugin({
  id: 'my-custom-inspector',
  label: 'My Custom Inspector',
  packageName: 'my-package',
  homepage: 'https://example.com',
  app: app
}, api => {
  api.addInspector({
    id: 'my-inspector',
    label: 'My Inspector',
    icon: 'bug_report'
  });

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

  api.on.getInspectorState((payload, context) => {
    if (payload.inspectorId === 'my-inspector') {
      payload.state = {
        'Root Node': [
          { key: 'example', value: 'This is an example state' }
        ]
      };
    }
  });
});

Custom Timeline Layer

This feature allows you to create a custom timeline layer in the Vue Devtools. The code sample demonstrates how to set up a custom timeline layer and add an event to it.

const { setupDevtoolsPlugin } = require('@vue/devtools-api');

setupDevtoolsPlugin({
  id: 'my-custom-timeline',
  label: 'My Custom Timeline',
  packageName: 'my-package',
  homepage: 'https://example.com',
  app: app
}, api => {
  api.addTimelineLayer({
    id: 'my-timeline',
    label: 'My Timeline',
    color: 0xff0000
  });

  api.addTimelineEvent({
    layerId: 'my-timeline',
    event: {
      time: Date.now(),
      data: {
        message: 'This is a custom timeline event'
      }
    }
  });
});

Custom State Inspector

This feature allows you to create a custom state inspector in the Vue Devtools. The code sample demonstrates how to set up a custom state inspector with a root node and some example state.

const { setupDevtoolsPlugin } = require('@vue/devtools-api');

setupDevtoolsPlugin({
  id: 'my-custom-state',
  label: 'My Custom State',
  packageName: 'my-package',
  homepage: 'https://example.com',
  app: app
}, api => {
  api.addInspector({
    id: 'my-state-inspector',
    label: 'My State Inspector',
    icon: 'storage'
  });

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

  api.on.getInspectorState((payload, context) => {
    if (payload.inspectorId === 'my-state-inspector') {
      payload.state = {
        'State Root': [
          { key: 'exampleState', value: 'This is an example state value' }
        ]
      };
    }
  });
});

Other packages similar to @vue/devtools-api

FAQs

Package last updated on 09 Sep 2024

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