Skip to content

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().

Reactive state

PropertyTypeDescription
logsRef<UnifiedLogEntry[]>All stored log entries
totalRequestsRef<number>Total number of entries
totalErrorsRef<number>Entries where error.occurred === true or http.status >= 400
averageDurationRef<number>Mean duration in milliseconds
totalDataSentRef<number>Sum of request.bodySize across all entries
totalDataReceivedRef<number>Sum of response.bodySize across all entries
mockGroupsRef<readonly MockRulesGroup[]>All mock groups with their rules
breakpointRulesRef<BreakpointRule[]>All configured breakpoint rules
activeBreakpointsRef<ActiveBreakpoint[]>Requests currently paused at a breakpoint

Control methods

typescript
enable() // Start capturing
disable() // Stop capturing (existing logs are preserved)
isEnabled() // Returns boolean
clear() // Remove all stored logs (triggers onFlush callback)

Query methods

typescript
// 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[]

Export

typescript
export()           // JSON string (default)
export('json')     // JSON string
export('csv')      // CSV string with header row

Statistics

typescript
getStats(): NetworkStats          // Full statistics object (see Statistics section)
getStatsSummary(): string         // Multi-line human-readable text

Subscription

typescript
const unsubscribe = subscribe((entry: UnifiedLogEntry) => {
  // called synchronously after each log entry is stored
})

unsubscribe() // stop receiving events

Mock methods

typescript
// Legacy flat API (proxied into the default group)
addMock(rule): MockRule
removeMock(id: string): void
getMocks(): MockRule[]

// Group management
addMockGroup(name: string): string              // returns groupId
renameMockGroup(groupId: string, name: string): void
toggleMockGroup(groupId: string, enabled: boolean): void
removeMockGroup(groupId: string): void

// Rules within a group
addMockToGroup(groupId: string, rule: Partial<MockRule>): MockRule
updateMockInGroup(groupId: string, ruleId: string, patch: Partial<MockRule>): void
removeMockFromGroup(groupId: string, ruleId: string): void

// Bulk replace (used by import)
replaceMockGroups(groups: MockRulesGroup[]): void

Throttle methods

typescript
setThrottle(preset: 'none' | 'fast3g' | 'slow3g' | 'offline'): void
getThrottleDelay(): number   // current delay in milliseconds

Breakpoint methods

typescript
// 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): () => void

Types:

typescript
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
}