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

Use localstorage option in sysend #41

Closed
jkrajinovic opened this issue Jun 10, 2022 · 7 comments
Closed

Use localstorage option in sysend #41

jkrajinovic opened this issue Jun 10, 2022 · 7 comments

Comments

@jkrajinovic
Copy link

Hi, great library.

It would be nice if we can tell sysend to use localStorage instead of BroadcastChannel throgh options.

The use case is offline web application that run from filesystem.

Thanks

@jkrajinovic jkrajinovic changed the title Use localstorage optinoally Use localstorage option in sysend Jun 10, 2022
@jcubic
Copy link
Owner

jcubic commented Jun 10, 2022

Do you mean file:// protocol or something else?

Does BroadcastChannel throw some kind of error when used from filesystem? If that's the case I can easily use localStorage as a fallback. With this you will not need to specify the option, it will work out of the box.

@jcubic
Copy link
Owner

jcubic commented Aug 22, 2022

I think that I can add this API:

sysend.setup({ mode: 'localStorage' });
// or
sysend.useLocalStorage();

jcubic added a commit that referenced this issue Aug 22, 2022
@jcubic
Copy link
Owner

jcubic commented Aug 22, 2022

New API added in version 1.14.0

@jcubic jcubic closed this as completed Aug 22, 2022
@jkrajinovic
Copy link
Author

Hi,
yes file:// protocol exactly.

Sorry for not responding saw the comments only now.

BroadcastChannel didn't throw any errors as I remember.

I'll investigate and get back.

Thank you very much for this option.

@jcubic
Copy link
Owner

jcubic commented Aug 22, 2022

I just checked the file:// protocol and it works without issues. Just open demo.html in the browser.

@jcubic
Copy link
Owner

jcubic commented Aug 22, 2022

But the option will also be useful. I'll update the demo to be able to turn off BroadcastChannel for testing.

jcubic added a commit that referenced this issue Aug 22, 2022
jcubic added a commit that referenced this issue Aug 22, 2022
@jcubic
Copy link
Owner

jcubic commented Aug 22, 2022

I've updated the demo to allow to turn off the localStorage and fix the parsing of file:// protocol because it was giving a warning from the proxy iframe.

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