MCPcopy
hub / github.com/Tencent/vConsole / apply

Method apply

src/network/fetch.proxy.ts:121–134  ·  view source on GitHub ↗
(target: T, thisArg: typeof window, argsList)

Source from the content-addressed store, hash-verified

119 }
120
121 public apply(target: T, thisArg: typeof window, argsList) {
122 const input: RequestInfo = argsList[0];
123 const init: RequestInit = argsList[1];
124 const item = new VConsoleNetworkRequestItem();
125 this.beforeFetch(item, input, init);
126
127 return (<ReturnType<T>>target.apply(window, argsList)).then(this.afterFetch(item)).catch((e) => {
128 // mock finally
129 item.endTime = Date.now();
130 item.costTime = item.endTime - (item.startTime || item.endTime);
131 this.onUpdateCallback(item);
132 throw e;
133 });
134 }
135
136 protected beforeFetch(item: VConsoleNetworkRequestItem, input: RequestInfo, init?: RequestInit) {
137 let url: URL,

Callers 10

getOpenMethod · 0.45
getSendMethod · 0.45
getSetRequestHeaderMethod · 0.45
setOnReadyStateChangeMethod · 0.45
setOnAbortMethod · 0.45
setOnTimeoutMethod · 0.45
getMethod · 0.45
mockReaderMethod · 0.45
triggerEventMethod · 0.45
callOriginalConsoleMethod · 0.45

Calls 3

beforeFetchMethod · 0.95
afterFetchMethod · 0.95
thenMethod · 0.80

Tested by

no test coverage detected