Am I using Port Messaging correctly?
I have the following:
background/ports/alarms.ts
background/index.ts
foreground/somewhere.ts
finally in foreground/index.tsx
I see
adding listener
in the console but whenever the alarm is triggered I get this error: checked runtime.lastError: Could not establish connection. Receiving end does not exist.
2 Replies
Do you need the port api for this or can you just use the alarm callback directly?
apparently, ports are whiped by the bgsw if inactive for 5 minutes or so
Hmm, for context I am building a timer and I want it to work even if the tab is closed
Seems like the only way to do that is set an alarm and then process it in the background script
actually youre right, I probably dont need the port