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

Original 'mailto' handler not called, if owaIntercept == "off" #10

Open
kriegaex opened this issue Jun 19, 2022 · 1 comment
Open

Original 'mailto' handler not called, if owaIntercept == "off" #10

kriegaex opened this issue Jun 19, 2022 · 1 comment

Comments

@kriegaex
Copy link

This code is always executed for mailto: links:

MailtOWA/mailtowa.js

Lines 18 to 21 in 60caaab

e.preventDefault();
e.stopImmediatePropagation();
e.stopPropagation();
return false;

Fetching the config value from chrome.storage.sync is inherently asynchronous, so I know it is difficult to fetch the config value and use it in a condition skipping those lines of code, if the user setting is "off", but this could be fixed by caching the configuration locally, also making sure that the cache is getting refreshed, using an event handler reacting to changes in chrome.storage.sync. I do not speak JS at all, but I think this is the way you handle such things in a language like this, trying to escape the infamous callback hell.

@kriegaex
Copy link
Author

kriegaex commented Jun 19, 2022

Disclaimer: In my fork, I modified the extension to fit my needs for another type of web mailer. This is my very first try to write or modify any JS code, so probably the code is horrible. Of course, I also never wrote a Chrome extension.

You may want to refer to my content script in order to see how I am using localStorage as a cache for chrome.storage.sync. Maybe you want to do something similar. In my case, it solves the problem.

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

No branches or pull requests

1 participant