Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page script should not try executing service worker code #229

Closed
alanhamlett opened this issue Aug 26, 2023 · 1 comment · Fixed by #230
Closed

Page script should not try executing service worker code #229

alanhamlett opened this issue Aug 26, 2023 · 1 comment · Fixed by #230
Assignees
Labels

Comments

@alanhamlett
Copy link
Member

alanhamlett commented Aug 26, 2023

await WakaTimeCore.recordHeartbeat(projectDetails);

The page script needs to post a message to the service worker instead of directly calling code meant to only run in the background with access to the Chrome extension api.

To fix this, send a message to the service worker with the current page's DesignProject info as JSON. Listen for that message in the service worker, save the DesignProject data and re-use it for all future heartbeats sent for the current tab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants