Document hooking into the Network panel of DevTools (for plugins)
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 文档
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- devtools, javascript, typescript
调研方向
首先定位当前的 Debugging 文档,以及旧内容中引用的当前 debugger.ts 接口。检查 Network 面板的回调,并使用最新的核心 API 指南替换过时的链接和示例。当一份面向插件作者的独立指南能够准确说明当前的请求和响应生命周期时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
There are global APIs to list Netowork requests in the DevTools Network panel, we should document these in a guide for plugin authors. This used to be part of the "Debugging" docs, however it doesn't quite fit there.
The content itself needs to be reviewed and updated to reflect latest core (the API is mostly unchanged, but the docs contain old links).
Old content for reference
Network requests in plugins - Note: The following content concerns only plugin authors who wrap and expose Android (Network agent in DevTools not yet supported with a public API in the iOS runtime) http functionalities. To make your http functionality debuggable, there are callbacks you need to call at certain times of the lifecycle of the network request, following a specific protocol. For your convenience, we've exposed callbacks and TypeScript interfaces to facilitate sending information to the Network agent.
- Immediately before making the request:
Check if theglobal.__inspectorobject is available, and whether the DevTools are connected:
if (global.__inspector && global.__inspector.isConnected) {
}
Build a RequestData-compliant object, as declared in the debugger module. RequestData contains the minimum subset of properties needed to display request entries in the Network panel. Finally call to the runtime-exposed callback:
global.__inspector.requestWillBeSent(requestData)
-
When a response is received:
Check if the
global.__inspectorobject is available, and whether the DevTools are connected, as shown above. Build a ResponseData-compliant object, as declared in the debugger module.ResponseDatacontains the minimum subset of properties needed to display the response for a completed request.Build a LoadingFinishedData compliant object, as declared in the debugger module. The object notifies the Network agent that a request has completed, as well as the time spent.
Build a SuccessfulRequestData-compliant object, as declared in the debugger module. The object contains the response data, in a string format, the Id of the original request the response data corresponds to, and information whether the content should be base64-encoded, or not.
Finally call the following runtime-exposed callbacks:
global.__inspector.responseReceived(responseData) global.__inspector.loadingFinished({ requestId: requestIdStr, timestamp: getTimeStamp(), }) global.__inspector.dataForRequestId(successfulRequestData)
- 主要语言
- JavaScript
- 星标
- 17
- 派生
- 31
- 平均合并
- 8 小时 51 分钟
- 30 天内合并 PR
- 2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NativeScript/docs 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 68/100
NativeScript/docs#177 ·
-
难度 3/5 1-2 天 新手友好度 38/100
NativeScript/docs#189 ·
-
Label: maxLines 未关闭
难度 1/5 1 小时以内 新手友好度 48/100
NativeScript/docs#182 ·
-
难度 3/5 1-2 天 新手友好度 45/100
NativeScript/docs#178 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 35/100
NativeScript/docs#159 ·
查看 NativeScript/docs 的全部 Issue
相似的 Issue
-
documentation
难度 2/5 1-3 小时 新手友好度 88/100
githubnext/gh-aw-workshop#3692 ·
-
agent/guide documentation hive/hosted-available-lke648397-260827-5n31
难度 2/5 1-3 小时 新手友好度 90/100
-
Add: BuyPass TV 未关闭channels:add check:passed
难度 2/5 1-3 小时 新手友好度 75/100
-
S: triage
难度 1/5 1 小时以内 新手友好度 85/100
-
bug
难度 1/5 1 小时以内 新手友好度 90/100
apache/cloudstack#14222 ·