(target: T, thisArg: typeof window, argsList)
| 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, |
no test coverage detected