Skip to content

Mobile Debugging Tools

NPM Version

Setup

  1. Install the plugin
bash
$ npm add @winner-fed/plugin-wconsole -D
bash
$ yarn add @winner-fed/plugin-wconsole -D
bash
$ pnpm add @winner-fed/plugin-wconsole -D
bash
$ bun add @winner-fed/plugin-wconsole -D
  1. Enable the plugin in the .winrc configuration file
ts
import { defineConfig } from 'win';

export default defineConfig({
  plugins: [require.resolve('@winner-fed/plugin-wconsole')],
  wconsole: {
    // You can use any one of the three or all of them
    vconsole: {},
    eruda: {},
    pagespy: {}
  },
  appConfig: {
    development: {
      API_HOME: 'https://api.github.com/',
      API_UPLOAD: 'https://api.github.com/upload',
      // Debug tools enable switch
      IS_OPEN_VCONSOLE: true
    },
  }
});

Introduction

A collection of commonly used mobile debugging tools for WinJS projects. Currently includes vConsole, eruda, and PageSpy.

Note

To ensure consistency with enabling debug tools in previous projects, you need to add the IS_OPEN_VCONSOLE property to your project's configuration file before enabling the plugin. This means mounting the IS_OPEN_VCONSOLE property on window.LOCAL_CONFIG and setting its value to true.

Configuration

vConsole

js
import { defineConfig } from 'win';

export default defineConfig({
  plugins: [require.resolve('@winner-fed/plugin-wconsole')],
  wconsole: {
    vconsole: {
      defaultPlugins: Array(string),
      onReady: Function,
      disableLogScrolling: Boolean,
      theme: String,
      url: String
    },
  }
});
Property NameTypeOptionalDefault ValueDescription
defaultPluginsArray(String)true['system', 'network', 'element', 'storage']Built-in plugins that need to be automatically initialized and loaded.
onReadyFunctiontrueCallback method triggered when vConsole completes initialization and loads built-in plugins.
disableLogScrollingBooleantrueIf false, the panel will not automatically scroll to the bottom when there are new logs.
themeStringtrue'light'Theme color, options are 'light'
urlStringtrue'https://cdnjs.cloudflare.com/ajax/libs/vConsole/3.14.7/vconsole.min.js'vConsole file URL to load.

Reference: here

eruda

js
import { defineConfig } from 'win';

export default defineConfig({
  plugins: [require.resolve('@winner-fed/plugin-wconsole')],
  wconsole: {
    eruda: {
      container: String,
      tool: Array(String),
      autoScale: Boolean,
      useShadowDom: Boolean,
      defaults: Object,
      url: String
    },
  }
});
Property NameTypeOptionalDefault ValueDescription
containerStringtrueDOM element for plugin initialization. If not set, a div container is created by default and placed directly under the HTML root node.
toolArray(String)trueSpecify which panels to initialize, loads all by default.
autoScaleBooleantruetrueAuto scale under different viewports
useShadowDomBooleantruetrueUse Shadow DOM for CSS encapsulation
defaultsObjecttrue{ displaySize: 50, transparency: 0.9, theme: 'Monokai Pro' }Default settings.
urlStringtrue'https://cdnjs.cloudflare.com/ajax/libs/eruda/3.0.1/eruda.min.js'eruda file URL to load.

Reference: here

Released under the MIT License.