MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / on_message

Function on_message

extension/src/background.ts:258–331  ·  view source on GitHub ↗
(port: Port, e: Message)

Source from the content-addressed store, hash-verified

256}
257
258function on_message(port: Port, e: Message) {
259
260 DEV: {place_log(Place_Name.Background, 'Message', e, 'from', port)}
261
262 switch (port.name) {
263 case Connection_Name.Popup: {
264 break
265 }
266 case Connection_Name.Content: {
267 let tab_id = get_assert_tab_id(port, Place_Name.Content)
268
269 let content = script_content_map.get(tab_id)
270 assert(content)
271
272 // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
273 switch (e.kind) {
274 case 'Detected': {
275 content.detection = e.data
276
277 if (popup) {
278 port_post_message_obj(popup.port, e)
279 }
280
281 toggle_action_icon(tab_id)
282
283 break
284 }
285 case 'Versions': {
286 content.versions = e.data
287
288 if (popup) {
289 port_post_message_obj(popup.port, e)
290 }
291
292 let devtools = script_devtools_map.get(tab_id)
293 if (devtools) {
294 port_post_message_obj(devtools.port, e)
295 }
296
297 let panel = script_panel_map.get(tab_id)
298 if (panel) {
299 port_post_message_obj(panel.port, e)
300 }
301
302 break
303 }
304 default: {
305 // Forward all other messages to panel
306 let panel = script_panel_map.get(tab_id)
307 if (panel) {
308 port_post_message_obj(panel.port, e)
309 }
310 }
311 }
312
313 break
314 }
315 case Connection_Name.Devtools: {

Callers 1

background.tsFile · 0.85

Calls 7

place_logFunction · 0.90
assertFunction · 0.90
port_post_message_objFunction · 0.90
place_errorFunction · 0.90
get_assert_tab_idFunction · 0.85
toggle_action_iconFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…