![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 3 of 3 total |
![]() |
Wed, May 1 2013 2:30 AM | Permanent Link |
Christian Kaufmann | I try to read a string from local storage. If it's not defined, ADefault should be returned. How do I have to check the Result on undefined value?
function BSGetLocalString(const AName: String; const ADefault: String = ''): String; begin Result := window.localStorage.items[AName]; if Result = 'undefined' then Result := ADefault; end; cu Christian |
Wed, May 1 2013 5:09 AM | Permanent Link |
Matthew Jones | What I chose to do was have a value that shows if I have initialised the local
storage (saved anything). szInitialiseCheck := Window.LocalStorage.GetItem('store_initialised'); if szInitialiseCheck = '1' then begin // read the rest end; Given that the value won't be '1' if I didn't save it, then this works for me. It would be good to have a better solution though. I think Tim said he was going to enhance this at some point, not sure if it is for next update. /Matthew Jones/ |
Fri, May 3 2013 9:46 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Christian,
<< I try to read a string from local storage. If it's not defined, ADefault should be returned. How do I have to check the Result on undefined value? >> Compare against nil: var TempValue: String; begin TempValue := window.localStorage.items['Test']; if (TempValue=nil) then ShowMessage('Not defined') else ShowMessage('Defined'); end; Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Friday, December 1, 2023 at 06:01 PM | Privacy Policy![]() © 2023 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |