Commit ad04a7d
authored
[Function] Add heartbeat to service worker (#400)
## Overview
This PR adds heartbeat event in web service worker so that the client
can monitor its status and respond correspondingly.
## Primary Changes
- Update `{ type: "keepAlive" }` event to `{ kind: "keepAlive" }` to
keep all event format consistent
- Add heartbeat event in web service worker handler to report back its
status
## Testing
<img width="616" alt="Screenshot 2024-05-15 at 2 01 51 AM"
src="https://github.com/mlc-ai/web-llm/assets/23090573/42fcd7b0-f8f2-4b23-80c3-664426853161">1 parent 4d1915e commit ad04a7d
3 files changed
+45
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | 151 | | |
155 | 152 | | |
156 | 153 | | |
| |||
191 | 188 | | |
192 | 189 | | |
193 | 190 | | |
194 | | - | |
| 191 | + | |
195 | 192 | | |
196 | 193 | | |
197 | 194 | | |
198 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
| 202 | + | |
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
77 | 87 | | |
78 | 88 | | |
79 | 89 | | |
| |||
114 | 124 | | |
115 | 125 | | |
116 | 126 | | |
117 | | - | |
| 127 | + | |
118 | 128 | | |
119 | 129 | | |
120 | 130 | | |
| |||
147 | 157 | | |
148 | 158 | | |
149 | 159 | | |
150 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
151 | 163 | | |
152 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
153 | 177 | | |
154 | 178 | | |
155 | 179 | | |
156 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
157 | 190 | | |
158 | 191 | | |
159 | 192 | | |
| |||
0 commit comments