microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
src/extension/networkInspector/views/inspectorView.ts
35lines · modeblame
4bb0956eRedMickey5 years ago | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for details. | |
| 3 | | |
| 4 | import { Disposable } from "vscode"; | |
09f6024fHeniker4 years ago | 5 | import { RequestParams } from "../clientDevice"; |
4bb0956eRedMickey5 years ago | 6 | import { Request, Response, PartialResponse } from "../networkMessageData"; |
| 7 | import { RequestBodyFormatter } from "../requestBodyFormatters/requestBodyFormatter"; | |
| 8 | import { OutputChannelLogger } from "../../log/OutputChannelLogger"; | |
| 9 | | |
| 10 | export enum InspectorViewType { | |
| 11 | console, | |
| 12 | } | |
| 13 | | |
| 14 | export abstract class InspectorView implements Disposable { | |
| 15 | protected requestBodyDecoder: RequestBodyFormatter; | |
| 16 | protected requests: Map<string, Request>; | |
| 17 | protected responses: Map<string, Response>; | |
| 18 | protected partialResponses: Map<string, PartialResponse>; | |
| 19 | protected isInitialized: boolean; | |
| 20 | protected logger: OutputChannelLogger; | |
| 21 | | |
| 22 | constructor(logger: OutputChannelLogger) { | |
| 23 | this.logger = logger; | |
| 24 | this.requests = new Map(); | |
| 25 | this.responses = new Map(); | |
| 26 | this.partialResponses = new Map(); | |
| 27 | this.isInitialized = false; | |
| 28 | this.requestBodyDecoder = new RequestBodyFormatter(this.logger); | |
| 29 | } | |
| 30 | | |
| 31 | public dispose(): void {} | |
| 32 | | |
| 33 | public abstract init(): Promise<void>; | |
| 34 | public abstract handleMessage(data: RequestParams): void; | |
| 35 | } |