Instance API
All methods below are available on the object returned by useNetworkDashboard(), on this.$networkDashboard in the Options API, or on the instance returned by createNetworkDashboard(). A small number of lower-level methods (getOptions(), updateOptions(), getSize(), updateLog()) are only available on the raw class — construct it directly with new NetworkDashboard(options) (imported from vue-network-dashboard) if you need them.
Reactive state
| Property | Type | Description |
|---|---|---|
logs | Ref<UnifiedLogEntry[]> | All stored log entries |
totalRequests | Ref<number> | Total number of entries |
totalErrors | Ref<number> | Entries where error.occurred === true or http.status >= 400 |
averageDuration | Ref<number> | Mean duration in milliseconds |
totalDataSent | Ref<number> | Sum of request.bodySize across all entries |
totalDataReceived | Ref<number> | Sum of response.bodySize across all entries |
mockGroups | Ref<readonly MockRulesGroup[]> | All mock groups with their rules |
breakpointRules | Ref<BreakpointRule[]> | All configured breakpoint rules |
activeBreakpoints | Ref<ActiveBreakpoint[]> | Requests currently paused at a breakpoint |
Control methods
enable() // Start capturing
disable() // Stop capturing (existing logs are preserved)
isEnabled() // Returns boolean
clear() // Remove all stored logs (triggers onFlush callback)Query methods
// Filter by transport type
getLogsByType('http' | 'websocket' | 'sse'): UnifiedLogEntry[]
// Filter by URL string or regex
getLogsByUrl('/api/users'): UnifiedLogEntry[]
getLogsByUrl(/^https:\/\/api\./): UnifiedLogEntry[]
// Filter by HTTP status range
getLogsByStatus([400, 599]): UnifiedLogEntry[] // all 4xx and 5xx
// Filter by HTTP method
getLogsByMethod('POST'): UnifiedLogEntry[]
// Only failed entries
getErrorLogs(): UnifiedLogEntry[]
// Composable query with multiple filters at once
queryLogs({
type: 'http',
method: 'GET',
url: /\/api\//,
minDuration: 500,
hasError: false,
}): UnifiedLogEntry[]useLogFilter and useHotkey are standalone composables exported from the package root for building your own custom debugger UI on top of the raw log/hotkey primitives — <NetworkDebugger> itself does not use either one internally; it filters its own live, debounced, sessionStorage-persisted log stream and handles its own toggle hotkey with separate, inline code.
import { useLogFilter } from 'vue-network-dashboard'
// useLogFilter takes a plain snapshot array, not a live Ref — filteredLogs
// reacts to changes to `filters`, but not to new entries logged afterward;
// call it again with a fresh array to pick up newly captured logs
const { filters, filteredLogs, resetFilters } = useLogFilter(dashboard.logs.value)
filters.value.url = 'api/users'
filters.value.type = 'http'
filters.value.hasError = true
// url, body, and route each also accept a "regex:"-prefixed pattern instead
// of a plain substring, e.g.:
filters.value.url = 'regex:/v1/users/\\d+/'FilterOptions also has method, status, minDuration, and wsMessagesOnly (restricts results to WebSocket message events) fields — call resetFilters() to restore all of them to their defaults.
Export
export() // JSON string (default)
export('json') // JSON string
export('csv') // CSV string with header row
export('har') // HTTP Archive (HAR 1.2) JSON stringExample:
const dashboard = useNetworkDashboard()
function downloadJson() {
const json = dashboard.export('json')
const blob = new Blob([json], { type: 'application/json' })
const url = URL.createObjectURL(blob)
Object.assign(document.createElement('a'), { href: url, download: 'network-logs.json' }).click()
}Logs can also be exported directly from the panel UI via the Export button in the header.
Statistics
getStats(): NetworkStats // Full statistics object (see Statistics section on Reference)
getStatsSummary(): string // Multi-line human-readable textSubscription
const unsubscribe = subscribe((entry: UnifiedLogEntry) => {
// called synchronously after each log entry is stored
})
unsubscribe() // stop receiving eventsExample — forward failed requests to external monitoring:
const { subscribe } = useNetworkDashboard()
const stop = subscribe((entry) => {
if (entry.error.occurred || (entry.http?.status ?? 0) >= 500) {
myMonitoring.capture(entry)
}
})
onUnmounted(stop)Mock methods
// Legacy flat API (proxied into the default group)
addMock(rule): MockRule
updateMock(id: string, patch: Partial<MockRule>): void
removeMock(id: string): void
clearMocks(): void
getMocks(): MockRule[]
// Group management
addMockGroup(name: string): MockRulesGroup
renameMockGroup(groupId: string, name: string): void
toggleMockGroup(groupId: string, enabled: boolean): void
expandMockGroup(groupId: string, isOpened: boolean): void
removeMockGroup(groupId: string): void
// Rules within a group
addMockToGroup(groupId: string, rule: Omit<MockRule, 'id'>): MockRule
updateMockInGroup(groupId: string, ruleId: string, patch: Partial<MockRule>): void
removeMockFromGroup(groupId: string, ruleId: string): void
// Bulk replace (used by import)
replaceMockGroups(groups: MockRulesGroup[]): voidaddMockGroup() returns the full group object ({ id, name, enabled, isOpened, rules }), not just an id — see Mock Groups for a full example.
Throttle methods
setThrottle(delayMs: number): void // 0 disables throttling
getThrottle(): number // current delay in millisecondsThe panel's throttle presets (Fast 3G, Slow 3G, Offline-ish) are UI-level shortcuts that call setThrottle() with a fixed millisecond value — see Network Throttling.
Breakpoint methods
// Rule management
addBreakpointRule(rule: Omit<BreakpointRule, 'id'>): BreakpointRule
removeBreakpointRule(id: string): void
updateBreakpointRule(id: string, patch: Partial<BreakpointRule>): void
getBreakpointRules(): BreakpointRule[]
// Controlling paused requests
releaseBreakpoint(id: string, edits: BreakpointEdits): void
cancelBreakpoint(id: string): void // throws AbortError in the caller
getActiveBreakpoints(): ActiveBreakpoint[]
// Subscribe to changes in the paused set
onActiveBreakpointsChange(cb: (list: ActiveBreakpoint[]) => void): () => voidTypes:
interface BreakpointRule {
id: string
urlPattern: string | RegExp
method?: string // e.g. 'POST'; omit to match any method
name?: string
enabled: boolean
}
interface ActiveBreakpoint {
id: string
url: string
method: string
requestHeaders: Record<string, string>
requestBody: unknown
timestamp: number
}
interface BreakpointEdits {
url: string
method: string
headers: Record<string, string>
body: string | null
}