aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorMatthew Shao <me@matshao.com>2017-08-08 22:33:41 +0800
committerMatthew Shao <me@matshao.com>2017-08-08 22:33:41 +0800
commit32957976f512ba0af75bae54670c0eb6b0e5456c (patch)
tree39de39401e7d6e203a0ae44422e59366e1c45548 /web
parentdd43722c184ea90be805b1fd6b6248a18e5d880e (diff)
downloadmitmproxy-32957976f512ba0af75bae54670c0eb6b0e5456c.tar.gz
mitmproxy-32957976f512ba0af75bae54670c0eb6b0e5456c.tar.bz2
mitmproxy-32957976f512ba0af75bae54670c0eb6b0e5456c.zip
[web] Remove activeFetches and onMessage in StaticBackend.
Diffstat (limited to 'web')
-rw-r--r--web/src/js/backends/static.js20
1 files changed, 1 insertions, 19 deletions
diff --git a/web/src/js/backends/static.js b/web/src/js/backends/static.js
index 676468ce..1de6b294 100644
--- a/web/src/js/backends/static.js
+++ b/web/src/js/backends/static.js
@@ -21,34 +21,16 @@ export default class StaticBackend {
}
fetchData(resource) {
- let queue = []
- this.activeFetches[resource] = queue
fetchApi(`/${resource}`)
.then(res => res.json())
.then(json => {
- if (this.activeFetches[resource] === queue)
- this.receive(resource, json)
+ this.receive(resource, json)
})
}
- onMessage(msg) {
- if (msg.cmd === CMD_RESET) {
- return this.fetchData(msg.resource)
- }
- if (msg.resource in this.activeFetches) {
- this.activeFetches[msg.resource].push(msg)
- } else {
- let type = `${msg.resource}_${msg.cmd}`.toUpperCase()
- this.store.dispatch({ type, ...msg})
- }
- }
-
receive(resource, data) {
let type = `${resource}_RECEIVE`.toUpperCase()
this.store.dispatch({ type, cmd: "receive", resource, data })
- let queue = this.activeFetches[resource]
- delete this.activeFetches[resource]
- queue.forEach(msg => this.onMessage(msg))
}
}