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

Multiple Windows (Safari and WKWebView) #16

Open
holtwick opened this issue Aug 19, 2021 · 2 comments
Open

Multiple Windows (Safari and WKWebView) #16

holtwick opened this issue Aug 19, 2021 · 2 comments

Comments

@holtwick
Copy link

First congratulations to your genius approach. It looks promising to solve many issues I face in my projects. Thanks for sharing this solution!

In particular for Safari and WKWebView I wonder if you have an idea how to have multiple windows open and still keep the data in sync. AFAIK there are not shared workers or other contexts except IndexedDB. This results in a similar situation as if one would open a SQLite database natively on different computers on a shared folder.

The only solution I see by now is to have a SQLite database per window and close it, once a window becomes inactive and reopen it, once the window becomes active.

Do you know about a better solution?

@holtwick holtwick changed the title Multiple Windows Multiple Windows (Safari and WKWebView) Aug 19, 2021
@quolpr
Copy link
Contributor

quolpr commented Aug 20, 2021

I am going to try to use https://github.com/pubkey/broadcast-channel to solve this issue.

It has a LeaderElection mechanism, ensuring that only one worker will be running. Then I will post messages from the other tabs to the channel, and the leader tab will communicate with the web worker. I am not sure what performance will be, but I hope it will work well 🤔

@holtwick
Copy link
Author

Thanks, this looks like a great library to bypass Safari limitations for shared states. I'm looking forward to seeing your results!

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

2 participants