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

Save Last Basemap selected in cookie #27

Open
Mansoun opened this issue May 22, 2021 · 2 comments
Open

Save Last Basemap selected in cookie #27

Mansoun opened this issue May 22, 2021 · 2 comments

Comments

@Mansoun
Copy link

Mansoun commented May 22, 2021

Hi.
I used your library for my project.
one question. how to save last basemap selected?
I want save the last basemap in cookie and when the user reopen the page, cookie basemap will select to show!
Please help me. :X

@brendan-ward
Copy link
Collaborator

This is not an appropriate usage of cookies; those are for transfer of information between client and server.

You could use the localStorage API in the browser to store that information.

You can use that information in your application before you instantiate this plugin by rearranging the basemap layers you pass in so that the persisted one is the first in the list, which will make it display by default.

I don't have the bandwidth or need to add this functionality here unless this becomes a common request. I may be willing to consider a PR, if this is implemented in a lightweight and easy to test way, and exposed behind a persist option.

@valerio-bozzolan
Copy link

Yup HTML5 localStorage rocks here.

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

3 participants