(resource: Resource)
| 109 | } |
| 110 | |
| 111 | fetchData(resource: Resource) { |
| 112 | const queue: Array<Action> = []; |
| 113 | this.activeFetches[resource] = queue; |
| 114 | return fetchApi(`./${resource}`) |
| 115 | .then((res) => res.json()) |
| 116 | .then((json) => { |
| 117 | // Make sure that we are not superseded yet by the server sending a RESET. |
| 118 | if (this.activeFetches[resource] === queue) |
| 119 | this.receive(resource, json); |
| 120 | }); |
| 121 | } |
| 122 | |
| 123 | onMessage(msg: { type: WebsocketMessageType; payload?: any }) { |
| 124 | switch (msg.type) { |