vconsole
- Version 3.15.1
- Published
- 391 kB
- 4 dependencies
- MIT license
Install
npm i vconsoleyarn add vconsolepnpm add vconsoleOverview
A lightweight, extendable front-end developer tool for mobile web page.
Index
Namespaces
lib/tool
- callWx()
- getBytesText()
- getDate()
- getEnumerableAndNonEnumerableKeys()
- getEnumerableKeys()
- getNonEnumerableKeys()
- getObjName()
- getPrototypeName()
- getStorage()
- getStringBytes()
- getStringWithinLength()
- getSymbolKeys()
- getUniqueID()
- getVisibleText()
- htmlEncode()
- isArray()
- isBigInt()
- isBoolean()
- isElement()
- isFunction()
- isIterable()
- isNull()
- isNumber()
- isObject()
- isPlainObject()
- isString()
- isSymbol()
- isUndefined()
- isWindow()
- isWxEnv()
- JSONStringify()
- safeJSONStringify()
- setStorage()
- sortArray()
Namespaces
namespace component/recycleScroller/recycleManager
module 'component/recycleScroller/recycleManager' {}function createRecycleManager
createRecycleManager: () => ( itemCount: number, start: number, end: number) => { key: number; index: number; show: boolean }[];namespace component/recycleScroller/resizeObserver
module 'component/recycleScroller/resizeObserver' {}function hasResizeObserver
hasResizeObserver: () => boolean;function useResizeObserver
useResizeObserver: () => | { new (callback: ResizeObserverCallback): ResizeObserver; prototype: ResizeObserver; } | typeof EmptyResizeObserver;class EmptyResizeObserver
class EmptyResizeObserver {}A ResizeObserver polyfill. ResizeObserver is not support in iOS 13.3
constructor
constructor(callback: (entries: any[], observer?: EmptyResizeObserver) => void);method disconnect
disconnect: () => void;method observe
observe: (target: Element | SVGElement, options?: any) => void;method unobserve
unobserve: (target: Element | SVGElement) => void;namespace component/recycleScroller/scroll/friction
module 'component/recycleScroller/scroll/friction' {}class Friction
class Friction {}* Friction physics simulation. Friction is actually just a simple power curve; the only trick is taking the natural log of the initial drag so that we can express the answer in terms of time.
constructor
constructor(drag: number);method done
done: (t: number) => boolean;method dx
dx: (t: number) => number;method set
set: (x: number, v: number, t?: number) => void;method x
x: (t: number) => number;namespace component/recycleScroller/scroll/linear
module 'component/recycleScroller/scroll/linear' {}namespace component/recycleScroller/scroll/scroll
module 'component/recycleScroller/scroll/scroll' {}class Scroll
class Scroll {}* Scroll combines Friction and Spring to provide the classic "flick-with-bounce" behavior.
constructor
constructor(getExtend: () => number, _enableSpring: boolean);method done
done: (t: number) => boolean;method dx
dx: (t: number) => number;method set
set: (x: number, v: number, t?: number) => void;method x
x: (t: number) => number;namespace component/recycleScroller/scroll/scrollHandler
module 'component/recycleScroller/scroll/scrollHandler' {}class ScrollHandler
class ScrollHandler implements TrackerHandler {}constructor
constructor(getExtent: () => number, _updatePosition: (pos: number) => void);method getPosition
getPosition: () => number;method onTouchCancel
onTouchCancel: () => void;method onTouchEnd
onTouchEnd: ( dx: number, dy: number, velocityX: number, velocityY: number) => void;method onTouchMove
onTouchMove: (dx: number, dy: number) => void;method onTouchStart
onTouchStart: () => void;method onWheel
onWheel: (x: number, y: number) => void;method scrollTo
scrollTo: (position: number, duration?: number) => void;method updatePosition
updatePosition: (position: number) => void;namespace component/recycleScroller/scroll/spring
module 'component/recycleScroller/scroll/spring' {}class Spring
class Spring {}constructor
constructor(mass: number, springConstant: number, damping: number);method done
done: (t: number) => boolean;method dx
dx: (t: number) => number;method set
set: (endPosition: number, x: number, velocity: number, t?: number) => void;method x
x: (t: number) => number;namespace component/recycleScroller/scroll/touchTracker
module 'component/recycleScroller/scroll/touchTracker' {}class TouchTracker
class TouchTracker {}constructor
constructor(_handler: TrackerHandler);property handleTouchCancel
handleTouchCancel: (e: TouchEvent) => void;property handleTouchEnd
handleTouchEnd: (e: TouchEvent) => void;property handleTouchMove
handleTouchMove: (e: TouchEvent) => void;property handleTouchStart
handleTouchStart: (e: TouchEvent) => void;property handleWheel
handleWheel: (e: WheelEvent) => void;interface TrackerHandler
interface TrackerHandler {}method onTouchCancel
onTouchCancel: () => void;method onTouchEnd
onTouchEnd: (x: number, y: number, velocityX: number, velocityY: number) => void;method onTouchMove
onTouchMove: (x: number, y: number) => void;method onTouchStart
onTouchStart: () => void;method onWheel
onWheel: (x: number, y: number) => void;namespace core/core
module 'core/core' {}class VConsole
class VConsole {}constructor
constructor(opt?: VConsoleOptions);property compInstance
protected compInstance: SvelteComponent;property instance
static instance: VConsole;Get singleton instance.
property isInited
isInited: boolean;property log
log: VConsoleLogExporter;property network
network: VConsoleNetworkExporter;property option
option: VConsoleOptions;property pluginList
protected pluginList: { [id: string]: VConsolePlugin };property system
system: VConsoleLogExporter;property VConsoleDefaultPlugin
static VConsoleDefaultPlugin: typeof VConsoleDefaultPlugin;property VConsoleElementPlugin
static VConsoleElementPlugin: typeof VConsoleElementPlugin;property VConsoleLogPlugin
static VConsoleLogPlugin: typeof VConsoleLogPlugin;property VConsoleNetworkPlugin
static VConsoleNetworkPlugin: typeof VConsoleNetworkPlugin;property VConsolePlugin
static VConsolePlugin: typeof VConsolePlugin;property VConsoleStoragePlugin
static VConsoleStoragePlugin: typeof VConsoleStoragePlugin;property VConsoleSystemPlugin
static VConsoleSystemPlugin: typeof VConsoleSystemPlugin;property version
version: string;method addPlugin
addPlugin: (plugin: VConsolePlugin) => boolean;Add a new plugin.
method destroy
destroy: () => void;Remove vConsole.
method hide
hide: () => void;Hide console panel.
method hideSwitch
hideSwitch: () => void;Hide switch button.
method removePlugin
removePlugin: (pluginID: string) => boolean;Remove a plugin.
method setOption
setOption: (keyOrObj: any, value?: any) => void;Update option(s).
Example 1
setOption('log.maxLogNumber', 20): set 'maxLogNumber' field only.Example 2
setOption({ log: { maxLogNumber: 20 }}): overwrite 'log' object.
method setSwitchPosition
setSwitchPosition: (x: number, y: number) => void;Update the position of Switch button.
method show
show: () => void;Show console panel.
method showPlugin
showPlugin: (pluginId: string) => void;Show a plugin panel.
method showSwitch
showSwitch: () => void;Show switch button
method triggerEvent
triggerEvent: (eventName: string, param?: any) => void;Trigger a
vConsole.optionevent.
namespace core/core.model
module 'core/core.model' {}variable contentStore
const contentStore: { subscribe: ( this: void, run: import('vendor/svelte/store').Subscriber<{ updateTime: number }>, invalidate?: (value?: { updateTime: number }) => void ) => import('vendor/svelte/store').Unsubscriber; set: (this: void, value: { updateTime: number }) => void; update: ( this: void, updater: import('vendor/svelte/store').Updater<{ updateTime: number }> ) => void; updateTime: () => void;};namespace core/options.interface
module 'core/options.interface' {}interface VConsoleLogOptions
interface VConsoleLogOptions {}property maxLogNumber
maxLogNumber?: number;property showTimestamps
showTimestamps?: boolean;interface VConsoleNetworkOptions
interface VConsoleNetworkOptions {}property ignoreUrlRegExp
ignoreUrlRegExp?: RegExp;property maxNetworkNumber
maxNetworkNumber?: number;interface VConsoleOptions
interface VConsoleOptions {}property defaultPlugins
defaultPlugins?: ('system' | 'network' | 'element' | 'storage')[];property disableLogScrolling
disableLogScrolling?: boolean;property log
log?: VConsoleLogOptions;property maxLogNumber
maxLogNumber?: number;Deprecated
Since v3.12.0, use
log.maxLogNumber.
property maxNetworkNumber
maxNetworkNumber?: number;Deprecated
Since v3.12.0, use
network.maxNetworkNumber.
property network
network?: VConsoleNetworkOptions;property onClearLog
onClearLog?: () => void;Deprecated
Since v3.12.0.
property onReady
onReady?: () => void;property pluginOrder
pluginOrder?: string[];property storage
storage?: VConsoleStorageOptions;property target
target?: string | HTMLElement;property theme
theme?: '' | 'dark' | 'light';interface VConsoleStorageOptions
interface VConsoleStorageOptions {}property defaultStorages
defaultStorages?: VConsoleAvailableStorage[];type VConsoleAvailableStorage
type VConsoleAvailableStorage = | 'cookies' | 'localStorage' | 'sessionStorage' | 'wxStorage';namespace element/element
module 'element/element' {}class VConsoleElementPlugin
class VConsoleElementPlugin extends VConsoleSveltePlugin {}vConsole Element Panel
constructor
constructor(id: string, name: string, renderProps?: {});property isInited
protected isInited: boolean;property nodeMap
protected nodeMap: WeakMap<Node, IVConsoleNode>;property observer
protected observer: MutationObserver;method onAddTool
onAddTool: (callback: any) => void;method onRemove
onRemove: () => void;method onShow
onShow: () => void;namespace element/element.model
module 'element/element.model' {}variable activedNode
const activedNode: Writable<IVConsoleNode>;variable rootNode
const rootNode: Writable<IVConsoleNode>;Element Store
interface IVConsoleNode
interface IVConsoleNode {}property attributes
attributes: { [name: string]: string;}[];property childNodes
childNodes: IVConsoleNode[];property className
className: typeof Element.prototype.className;property id
id: typeof Element.prototype.id;property nodeName
nodeName: typeof Node.prototype.nodeName;property nodeType
nodeType: typeof Node.prototype.nodeType;property textContent
textContent: typeof Node.prototype.textContent;namespace lib/model
module 'lib/model' {}class VConsoleModel
class VConsoleModel {}property singleton
static singleton: { [ctorName: string]: VConsoleModel };method getSingleton
static getSingleton: <T extends VConsoleModel>( ctor: AConstructorTypeOf<T>, ctorName: string) => T;Get a singleton of a model.
namespace lib/plugin
module 'lib/plugin' {}class VConsolePlugin
class VConsolePlugin {}vConsole Plugin Base Class
constructor
constructor(...args: any[]);property eventMap
eventMap: Map<IVConsolePluginEventName, IVConsolePluginEvent>;property exporter
exporter?: VConsolePluginExporter;property id
id: string;property isReady
isReady: boolean;property name
name: string;property vConsole
vConsole: VConsole;method bindExporter
protected bindExporter: () => void;method getUniqueID
protected getUniqueID: (prefix?: string) => string;method on
on: ( eventName: IVConsolePluginEventName, callback: IVConsolePluginEvent) => this;Register an event
Parameter IVConsolePluginEventName
Parameter IVConsolePluginEvent
Modifiers
@public
method onRemove
onRemove: () => void;method trigger
trigger: (eventName: IVConsolePluginEventName, data?: any) => this;Trigger an event.
method unbindExporter
protected unbindExporter: () => void;interface IVConsoleTabOptions
interface IVConsoleTabOptions {}property fixedHeight
fixedHeight?: boolean;interface IVConsoleToolbarOptions
interface IVConsoleToolbarOptions {}interface IVConsoleTopbarOptions
interface IVConsoleTopbarOptions {}type IVConsolePluginEvent
type IVConsolePluginEvent = (data?: any) => void;type IVConsolePluginEventName
type IVConsolePluginEventName = | 'init' | 'renderTab' | 'addTopBar' | 'addTool' | 'ready' | 'remove' | 'updateOption' | 'showConsole' | 'hideConsole' | 'show' | 'hide';namespace lib/pluginExporter
module 'lib/pluginExporter' {}class VConsolePluginExporter
class VConsolePluginExporter {}constructor
constructor(pluginId: string);property model
protected model: VConsoleModel;property pluginId
protected pluginId: string;method destroy
destroy: () => void;namespace lib/query
module 'lib/query' {}variable $
const $: { one: (selector: string, contextElement?: Element | Document) => HTMLElement; all: (selector: string, contextElement?: Element | Document) => HTMLElement[]; addClass: ($el: Element | Element[], className: string) => void; removeClass: ($el: Element | Element[], className: string) => void; hasClass: ($el: Element, className: string) => boolean; bind: ( $el: Element | Element[], eventType: any, fn: any, useCapture?: boolean ) => void; delegate: ( $el: Element, eventType: string, selector: string, fn: (event: Event, $target: HTMLElement) => void ) => void; removeChildren($el: Element): Element;};namespace lib/sveltePlugin
module 'lib/sveltePlugin' {}class VConsoleSveltePlugin
class VConsoleSveltePlugin<T extends {} = {}> extends VConsolePlugin {}constructor
constructor( id: string, name: string, CompClass: typeof SvelteComponent, initialProps: {});property CompClass
CompClass: typeof SvelteComponent;property compInstance
compInstance?: SvelteComponent;property initialProps
initialProps: {};method onReady
onReady: () => void;method onRemove
onRemove: () => void;method onRenderTab
onRenderTab: (callback: any) => void;namespace lib/tool
module 'lib/tool' {}function callWx
callWx: (method: string, ...args: any[]) => any;Call a WeChat Miniprogram method. E.g:
wx.getStorageSync().
function getBytesText
getBytesText: (bytes: number) => string;Convert bytes number to 'MB' or 'KB' string.
function getDate
getDate: (time: number) => { time: number; year: number; month: string | number; day: string | number; hour: string | number; minute: string | number; second: string | number; millisecond: string | number;};get formatted date by timestamp
function getEnumerableAndNonEnumerableKeys
getEnumerableAndNonEnumerableKeys: (obj: any) => string[];Get enumerable and non-enumerable keys of an object or array.
function getEnumerableKeys
getEnumerableKeys: (obj: any) => string[];Get enumerable keys of an object or array.
function getNonEnumerableKeys
getNonEnumerableKeys: (obj: any) => string[];Get non-enumerable keys of an object or array.
function getObjName
getObjName: (obj: any) => string;Get an object's constructor name.
function getPrototypeName
getPrototypeName: (value: any) => string;Get the prototype name of an object
function getStorage
getStorage: (key: string) => string;function getStringBytes
getStringBytes: (str: string) => number;Get the bytes of a string.
Example 1
'a' = 1
Example 2
'好' = 3
function getStringWithinLength
getStringWithinLength: (str: string, maxLen: number) => string;Get a string within a limited max length. The byte size of the string will be appended to the string when reached the limit. 'some string...(3.1 MB)'
function getSymbolKeys
getSymbolKeys: (obj: any) => symbol[];function getUniqueID
getUniqueID: (prefix?: string) => string;Generate a 6-digit unique string with prefix
"__vc_" + ${prefix}
function getVisibleText
getVisibleText: (text: string) => string;Convert a text's invisible characters to visible characters.
function htmlEncode
htmlEncode: (text: string | number) => string;Escape HTML to XSS-safe text.
function isArray
isArray: (value: any) => boolean;function isBigInt
isBigInt: (value: any) => boolean;function isBoolean
isBoolean: (value: any) => boolean;function isElement
isElement: (value: any) => boolean;function isFunction
isFunction: (value: any) => boolean;function isIterable
isIterable: (value: any) => boolean;function isNull
isNull: (value: any) => boolean;function isNumber
isNumber: (value: any) => boolean;Determine whether a value is of a specific type.
function isObject
isObject: (value: any) => boolean;function isPlainObject
isPlainObject: (obj: any) => boolean;check whether an object is plain (using {})
Parameter object
obj boolean
function isString
isString: (value: any) => boolean;function isSymbol
isSymbol: (value: any) => boolean;function isUndefined
isUndefined: (value: any) => boolean;function isWindow
isWindow: (value: any) => boolean;function isWxEnv
isWxEnv: () => boolean;Determine whether it is inside a WeChat Miniprogram.
function JSONStringify
JSONStringify: ( value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number) => string;Call original
JSON.stringifyand catch unknown exceptions.
function safeJSONStringify
safeJSONStringify: ( obj: any, opt?: { maxDepth?: number; keyMaxLen?: number; pretty?: boolean; standardJSON?: boolean; }) => string;A safe
JSON.stringifymethod.
function setStorage
setStorage: (key: string, value: string) => void;localStorage methods
function sortArray
sortArray: (arr: string[]) => string[];Sore an
string[]by string.
namespace log/default
module 'log/default' {}class VConsoleDefaultPlugin
class VConsoleDefaultPlugin extends VConsoleLogPlugin {}property onErrorHandler
protected onErrorHandler: any;property rejectionHandler
protected rejectionHandler: any;property resourceErrorHandler
protected resourceErrorHandler: any;method bindErrors
protected bindErrors: () => void;Catch window errors.
method catchResourceError
protected catchResourceError: () => void;Catch resource loading error: image, video, link, script.
method catchWindowOnError
protected catchWindowOnError: () => void;Catch
window.onerror.
method onReady
onReady: () => void;method onRemove
onRemove: () => void;method unbindErrors
protected unbindErrors: () => void;Not catch window errors.
namespace log/log
module 'log/log' {}class VConsoleLogPlugin
class VConsoleLogPlugin extends VConsoleSveltePlugin {}vConsole Log Plugin (base class).
constructor
constructor(id: string, name: string);property isInBottom
isInBottom: boolean;property isReady
isReady: boolean;property isShow
isShow: boolean;property model
model: VConsoleLogModel;method onAddTool
onAddTool: (callback: Function) => void;method onAddTopBar
onAddTopBar: (callback: Function) => void;method onReady
onReady: () => void;method onRemove
onRemove: () => void;method onUpdateOption
onUpdateOption: () => void;namespace log/log.exporter
module 'log/log.exporter' {}class VConsoleLogExporter
class VConsoleLogExporter extends VConsolePluginExporter {}property model
model: VConsoleLogModel;method addLog
protected addLog: (method: IConsoleLogMethod, ...args: any[]) => void;method clear
clear: () => void;method debug
debug: (...args: any[]) => void;method error
error: (...args: any[]) => void;method info
info: (...args: any[]) => void;method log
log: (...args: any[]) => void;method warn
warn: (...args: any[]) => void;namespace log/log.model
module 'log/log.model' {}class VConsoleLogModel
class VConsoleLogModel extends VConsoleModel {}******************************** Model ********************************
property ADDED_LOG_PLUGIN_ID
ADDED_LOG_PLUGIN_ID: string[];property flushLogScheduled
protected flushLogScheduled: boolean;property groupLabelCollapsedStack
protected groupLabelCollapsedStack: { label: symbol; collapsed: boolean }[];property groupLevel
protected groupLevel: number;property LOG_METHODS
readonly LOG_METHODS: IConsoleLogMethod[];property logCounter
protected logCounter: number;property logQueue
protected logQueue: IVConsoleLog[];property maxLogNumber
maxLogNumber: number;property origConsole
origConsole: { [method: string]: Function };The original
window.consolemethods.
property pluginPattern
protected pluginPattern: RegExp;method addLog
addLog: ( item?: { type: IConsoleLogMethod; origData: any[]; isGroupHeader?: 0 | 1 | 2; isGroupCollapsed?: boolean; }, opt?: IVConsoleAddLogOptions) => void;Add a vConsole log.
method bindPlugin
bindPlugin: (pluginId: string) => boolean;Bind a Log plugin. When binding first plugin,
window.consolewill be hooked.
method callOriginalConsole
callOriginalConsole: (method: string, ...args: any[]) => void;Call origin
window.console[method](...args)
method clearLog
clearLog: () => void;Remove all logs.
method clearPluginLog
clearPluginLog: (pluginId: string) => void;Remove a plugin's logs.
method evalCommand
evalCommand: (cmd: string) => void;Execute a JS command.
method mockConsole
mockConsole: () => void;Hook
window.consolewith vConsole log method. Methods will be hooked only once.
method resetGroup
resetGroup: () => void;Reset groups by
console.group().
method unbindPlugin
unbindPlugin: (pluginId: string) => boolean;Unbind a Log plugin. When no binded plugin exists, hooked
window.consolewill be recovered.
method unmockConsole
unmockConsole: () => void;Recover
window.console.
interface IVConsoleAddLogOptions
interface IVConsoleAddLogOptions {}interface IVConsoleLog
interface IVConsoleLog {}property cmdType
cmdType?: 'input' | 'output';property data
data: IVConsoleLogData[];property date
date: number;property groupCollapsed
groupCollapsed?: boolean;property groupHeader
groupHeader?: 0 | 1 | 2;property groupLabel
groupLabel?: symbol;property groupLevel
groupLevel: number;property repeated
repeated: number;property toggle
toggle: Record<string, boolean>;property type
type: IConsoleLogMethod;interface IVConsoleLogData
interface IVConsoleLogData {}type IConsoleLogMethod
type IConsoleLogMethod = 'log' | 'info' | 'debug' | 'warn' | 'error';******************************** Interfaces ********************************
type IVConsoleLogFilter
type IVConsoleLogFilter = { [pluginId: string]: string;};type IVConsoleLogListMap
type IVConsoleLogListMap = { [pluginId: string]: IVConsoleLog[];};namespace log/log.store
module 'log/log.store' {}class VConsoleLogStore
class VConsoleLogStore {}Log Store Factory
property storeMap
static storeMap: { [pluginId: string]: Writable<IVConsoleLogStore> };method create
static create: (pluginId: string) => Writable<IVConsoleLogStore>;Create a store.
method delete
static delete: (pluginId: string) => void;Delete a store.
method get
static get: (pluginId: string) => Writable<IVConsoleLogStore>;Get a store by pluginId,
method getAll
static getAll: () => { [pluginId: string]: Writable<IVConsoleLogStore> };Get all stores.
method getRaw
static getRaw: (pluginId: string) => IVConsoleLogStore;Get a store's raw data.
interface IVConsoleLogStore
interface IVConsoleLogStore {}property logList
logList: IVConsoleLog[];namespace log/logTool
module 'log/logTool' {}function getLastIdentifier
getLastIdentifier: (text: string) => { front: { text: string; pos: number; before: string; after: string }; back: { text: string; pos: number; before: string; after: string };};A simple parser to get
[or]information.
function getLogDatasWithFormatting
getLogDatasWithFormatting: (origDatas: any[]) => IVConsoleLogData[];Styling log output (
%c), or string substitutions (%s,%d,%o). Apply to the first log only.
function getValueTextAndType
getValueTextAndType: ( val: any, wrapString?: boolean) => { text: any; valueType: string };Get a value's text content and its type.
function isMatchedFilterText
isMatchedFilterText: (log: IVConsoleLog, filterText: string) => boolean;class VConsoleUninvocatableObject
class VConsoleUninvocatableObject {}An empty class for rendering views.
namespace log/system
module 'log/system' {}class VConsoleSystemPlugin
class VConsoleSystemPlugin extends VConsoleLogPlugin {}method onReady
onReady: () => void;method printSystemInfo
printSystemInfo: () => void;namespace network/beacon.proxy
module 'network/beacon.proxy' {}class BeaconProxy
class BeaconProxy {}property origSendBeacon
static origSendBeacon: (url: string | URL, data?: BodyInit) => boolean;method create
static create: (onUpdateCallback: IOnUpdateCallback) => any;class BeaconProxyHandler
class BeaconProxyHandler<T extends typeof navigator.sendBeacon> implements ProxyHandler<T> {}constructor
constructor(onUpdateCallback: IOnUpdateCallback);property onUpdateCallback
protected onUpdateCallback: IOnUpdateCallback;method apply
apply: (target: T, thisArg: T, argsList: any[]) => any;namespace network/fetch.proxy
module 'network/fetch.proxy' {}class FetchProxy
class FetchProxy {}class FetchProxyHandler
class FetchProxyHandler<T extends typeof fetch> implements ProxyHandler<T> {}constructor
constructor(onUpdateCallback: IOnUpdateCallback);property onUpdateCallback
protected onUpdateCallback: IOnUpdateCallback;method afterFetch
protected afterFetch: (item: any) => (resp: Response) => Response;method apply
apply: (target: T, thisArg: typeof window, argsList: any) => Promise<Response>;method beforeFetch
protected beforeFetch: ( item: VConsoleNetworkRequestItem, input: RequestInfo, init?: RequestInit) => void;method handleResponseBody
protected handleResponseBody: ( resp: Response, item: VConsoleNetworkRequestItem) => Promise<ArrayBuffer> | Promise<string>;class ResponseProxyHandler
class ResponseProxyHandler<T extends Response> implements ProxyHandler<T> {}constructor
constructor( resp: Response, item: VConsoleNetworkRequestItem, onUpdateCallback: IOnUpdateCallback);property item
item: VConsoleNetworkRequestItem;property onUpdateCallback
protected onUpdateCallback: IOnUpdateCallback;property resp
resp: Response;method get
get: (target: T, key: string) => any;method mockReader
protected mockReader: () => void;method set
set: (target: T, key: string, value: any) => boolean;namespace network/helper
module 'network/helper' {}function genFormattedBody
genFormattedBody: (body?: BodyInit) => string | { [key: string]: string };Generate formatted response body by XMLHttpRequestBodyInit.
function genGetDataByUrl
genGetDataByUrl: (url: string, getData?: {}) => {};Generate
getDataby url.
function genResonseByResponseType
genResonseByResponseType: (responseType: string, response: any) => string;Generate formatted response data by responseType.
function getURL
getURL: (urlString?: string) => URL;Get formatted URL object by string.
type IOnUpdateCallback
type IOnUpdateCallback = (item: VConsoleNetworkRequestItem) => void;namespace network/network
module 'network/network' {}class VConsoleNetworkPlugin
class VConsoleNetworkPlugin extends VConsoleSveltePlugin {}constructor
constructor(id: string, name: string, renderProps?: {});property exporter
exporter: VConsoleNetworkExporter;property model
model: VConsoleNetworkModel;method onAddTool
onAddTool: (callback: any) => void;method onReady
onReady: () => void;method onRemove
onRemove: () => void;method onUpdateOption
onUpdateOption: () => void;namespace network/network.exporter
module 'network/network.exporter' {}class VConsoleNetworkExporter
class VConsoleNetworkExporter extends VConsolePluginExporter {}namespace network/network.model
module 'network/network.model' {}variable requestList
const requestList: Writable<{ [id: string]: VConsoleNetworkRequestItem }>;Network Store
class VConsoleNetworkModel
class VConsoleNetworkModel extends VConsoleModel {}Network Model
constructor
constructor();property ignoreUrlRegExp
ignoreUrlRegExp: RegExp;property itemCounter
protected itemCounter: number;property maxNetworkNumber
maxNetworkNumber: number;method clearLog
clearLog: () => void;method limitListLength
protected limitListLength: () => void;method unMock
unMock: () => void;method updateRequest
updateRequest: (id: string, data: VConsoleNetworkRequestItem) => void;Add or update a request item by request ID.
namespace network/requestItem
module 'network/requestItem' {}class VConsoleNetworkRequestItem
class VConsoleNetworkRequestItem {}constructor
constructor();property actived
actived: boolean;property cancelState
cancelState?: 0 | 1 | 2 | 3;property costTime
costTime?: number;property endTime
endTime: number;property getData
getData: { [key: string]: string };property header
header: { [key: string]: string };property id
id: string;property method
method: VConsoleRequestMethod;property name
name?: string;property noVConsole
noVConsole?: boolean;property postData
postData: string | { [key: string]: string };property readyState
readyState?: number;property requestHeader
requestHeader: HeadersInit;property requestType
requestType: 'xhr' | 'fetch' | 'ping' | 'custom';property response
response: any;property responseSize
responseSize: number;property responseSizeText
responseSizeText: string;property responseType
responseType: XMLHttpRequestResponseType;property startTime
startTime: number;property startTimeText
startTimeText: string;property status
status: string | number;property statusText
statusText?: string;property url
url: string;class VConsoleNetworkRequestItemProxy
class VConsoleNetworkRequestItemProxy extends VConsoleNetworkRequestItem {}constructor
constructor(item: VConsoleNetworkRequestItem);property Handler
static Handler: { get(item: VConsoleNetworkRequestItemProxy, prop: string): any; set( item: VConsoleNetworkRequestItemProxy, prop: string, value: any ): boolean;};type VConsoleRequestMethod
type VConsoleRequestMethod = | '' | 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH';namespace network/xhr.proxy
module 'network/xhr.proxy' {}class XHRProxy
class XHRProxy {}property origXMLHttpRequest
static origXMLHttpRequest: { new (): XMLHttpRequest; prototype: XMLHttpRequest; readonly DONE: number; readonly HEADERS_RECEIVED: number; readonly LOADING: number; readonly OPENED: number; readonly UNSENT: number;};method create
static create: (onUpdateCallback: IOnUpdateCallback) => { new (): XMLHttpRequest; prototype: XMLHttpRequest; readonly DONE: number; readonly HEADERS_RECEIVED: number; readonly LOADING: number; readonly OPENED: number; readonly UNSENT: number;};class XHRProxyHandler
class XHRProxyHandler<T extends XMLHttpRequest> implements ProxyHandler<T> {}constructor
constructor(XMLReq: XMLHttpRequest, onUpdateCallback: IOnUpdateCallback);property item
item: VConsoleNetworkRequestItem;property onUpdateCallback
protected onUpdateCallback: IOnUpdateCallback;property XMLReq
XMLReq: XMLHttpRequest;method get
get: (target: T, key: string) => any;method getOpen
protected getOpen: (target: T) => (...args: any[]) => any;method getSend
protected getSend: (target: T) => (...args: any[]) => any;method getSetRequestHeader
protected getSetRequestHeader: (target: T) => (...args: any[]) => any;method onAbort
onAbort: () => void;method onReadyStateChange
onReadyStateChange: () => void;method onTimeout
onTimeout: () => void;method set
set: (target: T, key: string, value: any) => boolean;method setOnAbort
protected setOnAbort: (target: T, key: string, value: any) => boolean;method setOnReadyStateChange
protected setOnReadyStateChange: (target: T, key: string, value: any) => boolean;method setOnTimeout
protected setOnTimeout: (target: T, key: string, value: any) => boolean;method triggerUpdate
protected triggerUpdate: () => void;method updateItemByReadyState
protected updateItemByReadyState: () => void;Update item's properties according to readyState.
namespace storage/storage
module 'storage/storage' {}class VConsoleStoragePlugin
class VConsoleStoragePlugin extends VConsoleSveltePlugin {}constructor
constructor(id: string, name: string, renderProps?: {});property model
protected model: VConsoleStorageModel;property onAddTopBarCallback
protected onAddTopBarCallback: Function;method onAddTool
onAddTool: (callback: Function) => void;method onAddTopBar
onAddTopBar: (callback: Function) => void;method onReady
onReady: () => void;method onShow
onShow: () => void;method onUpdateOption
onUpdateOption: () => void;method updateTopBar
protected updateTopBar: () => void;namespace storage/storage.cookie
module 'storage/storage.cookie' {}class CookieStorage
class CookieStorage implements IStorage {}property keys
readonly keys: string[];Returns sorted keys.
property length
readonly length: number;method clear
clear: () => void;method getItem
getItem: (key: string) => string;method key
key: (index: number) => string;method removeItem
removeItem: (key: string, cookieOptions?: CookieOptions) => void;method setItem
setItem: (key: string, data: string, cookieOptions?: CookieOptions) => void;namespace storage/storage.model
module 'storage/storage.model' {}variable storageStore
const storageStore: { updateTime: import('vendor/svelte/store').Writable<number>; activedName: import('vendor/svelte/store').Writable<VConsoleAvailableStorage>; defaultStorages: import('vendor/svelte/store').Writable< VConsoleAvailableStorage[] >;};Storage Store
class VConsoleStorageModel
class VConsoleStorageModel extends VConsoleModel {}constructor
constructor();property activedStorage
readonly activedStorage: IStorage;property storage
protected storage: Map<VConsoleAvailableStorage, IStorage>;method clear
clear: () => Promise<void>;method deleteStorage
protected deleteStorage: (key: VConsoleAvailableStorage) => void;method getEntries
getEntries: () => Promise<[string, string][]>;Get key-value data.
method getItem
getItem: (key: string) => Promise<string>;method promisify
protected promisify: <T extends string | void>( ret: T | Promise<T>) => T | Promise<T>;method refresh
refresh: () => void;method removeItem
removeItem: (key: string) => Promise<void>;method setItem
setItem: (key: string, data: any) => Promise<void>;method updateEnabledStorages
updateEnabledStorages: () => void;interface IStorage
interface IStorage {}property clear
clear: () => void | Promise<void>;property getItem
getItem: (key: string) => string | null | Promise<string | null>;property key
key: (index: number) => string | null;property length
length: number;property prepare
prepare?: () => Promise<boolean>;property removeItem
removeItem: (key: string) => void | Promise<void>;property setItem
setItem: (key: string, data: any) => void | Promise<void>;namespace storage/storage.wx
module 'storage/storage.wx' {}class WxStorage
class WxStorage implements IStorage {}property currentSize
currentSize: number;property keys
keys: string[];property length
readonly length: number;property limitSize
limitSize: number;method clear
clear: () => Promise<void>;method getItem
getItem: (key: string) => Promise<string>;method key
key: (index: number) => string;method prepare
prepare: () => Promise<boolean>;Prepare for async data.
method removeItem
removeItem: (key: string) => Promise<void>;method setItem
setItem: (key: string, data: any) => Promise<void>;namespace vconsole
module 'vconsole' {}class VConsole
class VConsole {}constructor
constructor(opt?: VConsoleOptions);property compInstance
protected compInstance: SvelteComponent;property instance
static instance: VConsole;Get singleton instance.
property isInited
isInited: boolean;property log
log: VConsoleLogExporter;property network
network: VConsoleNetworkExporter;property option
option: VConsoleOptions;property pluginList
protected pluginList: { [id: string]: VConsolePlugin };property system
system: VConsoleLogExporter;property VConsoleDefaultPlugin
static VConsoleDefaultPlugin: typeof VConsoleDefaultPlugin;property VConsoleElementPlugin
static VConsoleElementPlugin: typeof VConsoleElementPlugin;property VConsoleLogPlugin
static VConsoleLogPlugin: typeof VConsoleLogPlugin;property VConsoleNetworkPlugin
static VConsoleNetworkPlugin: typeof VConsoleNetworkPlugin;property VConsolePlugin
static VConsolePlugin: typeof VConsolePlugin;property VConsoleStoragePlugin
static VConsoleStoragePlugin: typeof VConsoleStoragePlugin;property VConsoleSystemPlugin
static VConsoleSystemPlugin: typeof VConsoleSystemPlugin;property version
version: string;method addPlugin
addPlugin: (plugin: VConsolePlugin) => boolean;Add a new plugin.
method destroy
destroy: () => void;Remove vConsole.
method hide
hide: () => void;Hide console panel.
method hideSwitch
hideSwitch: () => void;Hide switch button.
method removePlugin
removePlugin: (pluginID: string) => boolean;Remove a plugin.
method setOption
setOption: (keyOrObj: any, value?: any) => void;Update option(s).
Example 1
setOption('log.maxLogNumber', 20): set 'maxLogNumber' field only.Example 2
setOption({ log: { maxLogNumber: 20 }}): overwrite 'log' object.
method setSwitchPosition
setSwitchPosition: (x: number, y: number) => void;Update the position of Switch button.
method show
show: () => void;Show console panel.
method showPlugin
showPlugin: (pluginId: string) => void;Show a plugin panel.
method showSwitch
showSwitch: () => void;Show switch button
method triggerEvent
triggerEvent: (eventName: string, param?: any) => void;Trigger a
vConsole.optionevent.
namespace vendor/core-js/stable/symbol
module 'vendor/core-js/stable/symbol' {}namespace vendor/mutation-observer
module 'vendor/mutation-observer' {}class MutationObserver
class MutationObserver {}namespace vendor/svelte
module 'vendor/svelte' {}class SvelteComponent
class SvelteComponent {}namespace vendor/svelte/store
module 'vendor/svelte/store' {}interface Subscriber
interface Subscriber<T> {}interface Unsubscriber
interface Unsubscriber {}interface Updater
interface Updater<T> {}interface Writable
interface Writable<T> {}Package Files (2)
Dependencies (4)
Dev Dependencies (22)
- @babel/core
- @babel/plugin-proposal-class-properties
- @babel/plugin-proposal-export-namespace-from
- @babel/plugin-proposal-object-rest-spread
- @babel/plugin-transform-block-scoping
- @babel/plugin-transform-runtime
- @babel/preset-env
- @babel/preset-typescript
- babel-loader
- babel-plugin-add-module-exports
- css-loader
- less
- less-loader
- style-loader
- svelte
- svelte-loader
- svelte-preprocess
- typescript
- webpack
- webpack-cli
- webpack-dev-server
- webpack-merge
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/vconsole.
- Markdown[](https://www.jsdocs.io/package/vconsole)
- HTML<a href="https://www.jsdocs.io/package/vconsole"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 7849 ms. - Missing or incorrect documentation? Open an issue for this package.
