MCPcopy
hub / github.com/vuejs/devtools-v6 / addTimelineEvent

Function addTimelineEvent

packages/app-backend-core/src/timeline.ts:140–169  ·  view source on GitHub ↗
(options: TimelineEventOptions, app: App, ctx: BackendContext)

Source from the content-addressed store, hash-verified

138}
139
140export async function addTimelineEvent(options: TimelineEventOptions, app: App, ctx: BackendContext) {
141 if (!SharedData.timelineRecording) {
142 return
143 }
144 const appId = app ? getAppRecordId(app) : null
145 const isAllApps = options.all || !app || appId == null
146
147 const id = ctx.nextTimelineEventId++
148
149 const eventData: TimelineEventOptions & WithId = {
150 id,
151 ...options,
152 all: isAllApps,
153 }
154 ctx.timelineEventMap.set(eventData.id, eventData)
155
156 ctx.bridge.send(BridgeEvents.TO_FRONT_TIMELINE_EVENT, {
157 appId: eventData.all ? 'all' : appId,
158 layerId: eventData.layerId,
159 event: mapTimelineEvent(eventData),
160 })
161
162 const layer = ctx.timelineLayers.find(l => (isAllApps || l.appRecord?.options.app === app) && l.id === options.layerId)
163 if (layer) {
164 layer.events.push(eventData)
165 }
166 else if (SharedData.debugInfo) {
167 console.warn(`Timeline layer ${options.layerId} not found`)
168 }
169}
170
171const initialTime = Date.now()
172export const dateThreshold = initialTime - 1_000_000

Callers 4

connectFunction · 0.90
performanceMarkStartFunction · 0.90
performanceMarkEndFunction · 0.90
setupBuiltinLayersFunction · 0.85

Calls 4

getAppRecordIdFunction · 0.90
mapTimelineEventFunction · 0.85
setMethod · 0.80
sendMethod · 0.80

Tested by

no test coverage detected