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

Remove window dependency for enhanced platform compatibility #386

Open
Pom4H opened this issue Mar 26, 2023 · 0 comments
Open

Remove window dependency for enhanced platform compatibility #386

Pom4H opened this issue Mar 26, 2023 · 0 comments

Comments

@Pom4H
Copy link
Contributor

Pom4H commented Mar 26, 2023

Is your feature request related to a problem? Please describe.

The current implementation of the metacom library relies on the global object window, which is not available on some non-browser environments, such as React Native. As a result, users of these platforms face difficulties when trying to use the metacom library. This dependency on the window object makes the library less flexible and limits its potential use cases.

Describe the solution you'd like

To make the metacom library more platform-agnostic, I propose that we remove the dependency on the global object window. Instead, we can use a more universal way to access the global object, such as globalThis. This would allow the library to be used on platforms where the window object is not available, like React Native, without causing any issues or requiring additional workarounds.

Describe alternatives you've considered

An alternative solution would be to provide a separate build of the metacom library specifically designed for use with React Native or other non-browser environments. However, this approach would require maintaining two separate codebases, which could lead to inconsistencies and make it more challenging to keep both versions up to date.

Another alternative would be to add an optional configuration parameter: "online" event listener. This would require additional documentation and could be less user-friendly than a platform-agnostic approach.

window.addEventListener('online', () => {

@Pom4H Pom4H changed the title Remove window dependency for enhanced platform compatibility Remove window dependency for enhanced platform compatibility Apr 19, 2023
@Pom4H Pom4H changed the title Remove window dependency for enhanced platform compatibility Remove window dependency for enhanced platform compatibility Apr 19, 2023
@Pom4H Pom4H changed the title Remove window dependency for enhanced platform compatibility Remove window dependency for enhanced platform compatibility Apr 19, 2023
@Pom4H Pom4H changed the title Remove window dependency for enhanced platform compatibility Remove window dependency for enhanced platform compatibility Apr 19, 2023
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