Skip to content

Commit

Permalink
feat(network): add requests api #132
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Feb 2, 2020
1 parent e1b9c1c commit fc3464a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions doc/TOOL_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ Display requests.

Clear requests.

### requests

Get request data.

```javascript
network.clear();
```
Expand Down
10 changes: 9 additions & 1 deletion src/Network/Network.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
isEmpty,
$,
ms,
trim
trim,
each
} from '../lib/util'
import evalCss from '../lib/evalCss'

Expand Down Expand Up @@ -123,6 +124,13 @@ export default class Network extends Tool {

if (this._origFetch) window.fetch = this._origFetch
}
requests() {
const ret = []
each(this._requests, request => {
ret.push(request)
})
return ret
}
_addReq(id, data) {
defaults(data, {
name: '',
Expand Down

0 comments on commit fc3464a

Please sign in to comment.