Page 1 of 1
New public methods to BrowserHelper
Posted: Thu Sep 15, 2022 3:35 pm
by pmiklashevich
Hi team!
You're using some methods on BrowserHelper in examples/_shared/shared.js
(for example in scheduler) to implement the theme switcher in your demos. To store the selected value in LocalStorage you're using: storageAvailable
, setLocalStorageItem
, getLocalStorageItem
, removeLocalStorageItem
. We find them useful. Could you please consider to make them public? Thanks in advance.
Best,
Pavel
Re: New public methods to BrowserHelper
Posted: Fri Sep 16, 2022 8:24 am
by alex.l
Hi Pavel,
Why do you need those public and don't use localStorage directly? We didn't do a lot with that.
Re: New public methods to BrowserHelper
Posted: Fri Sep 16, 2022 9:58 am
by pmiklashevich
Hi Alex! Yes, the helper has many useful stuff in there. So it would be nice to review the file and make things public if possible. What I have seen so far, a developer of my team referred to your shared.js file to see how the theme picker is implemented. He found the usage and copy-pasted the methods to our source code. I don't like the idea of copy-pasting and I believe it is a valid request to make those functions public. They provide a safe way to work with localStorage. So before read/write/delete it checks if the local storage is available.