LocalStorage on main page loading - Forum

Forum Navigation
You need to log in to create posts and topics.

LocalStorage on main page loading

Hi..

Local storage

When i try to read from Local Storage at first page (index) i get undefined as result.
After page has loaded if you press the button NeoGet, you get the result.

I have tried to put Delay or Wait but the problem remains.

Thanks

Uploaded files:
  • You need to login to have access to uploads.

@smartmedia

When i try to read from Local Storage at first page (index) i get undefined as result.

Actually, the problem is with the AlertBox command that follows; I added a Container to your page with the content as ...

Status is [Status]

... while the AlertBox says undefined, the content of the Container shows the correct value (of 1)

I am guessing that the neoGetItem command is still waiting for the data (to arrive from Local Storage) while the AlertBox command is being serviced.

Inserting a ...

Wait 900

... before the AlertBox worked for me ... the mileage on your computer may/will be different

smartmedia has reacted to this post.
smartmedia

Hi @Gaev,

I put the Alertbox to show that returns underfined. I have also used Wait and Delay up to 3 seconds with no result. That happens only to first page (index), on other pages i receive the results normally. I don't know if it has something to do with NeoGet that it runs from a subroutine in my script. My drive is SSD and has good RW speeds.

Update, i finally solved by using intermediate steps prior to read from local storage. Also notice that putting Wait command in a button in custom dialog window doesn't run the code at all.

@smartmedia

I put the Alertbox to show that returns underfined. I have also used Wait and Delay up to 3 seconds with no result.

I placed the Wait command in the Page Enter section ... after the neoGetItem and before the AlertBox.

Before, the AlertBox would show undefined but the Container would show 1 ... with the Wait, both showed 1

Difficult to see the sequence of AlertBox vs. Container update.

That happens only to first page (index), on other pages i receive the results normally.

That adds to the theory that AlertBox is serviced before the Local Sotrage data is retrieved ... once retrieved, subsequent requests are probably serviced from memory/cache.

I don't know if it has something to do with NeoGet that it runs from a subroutine in my script.

I was using the neoapp you shared on this forum ... I did try to deploy it in the onDocumentReady subroutine ... but that did not help.

My drive is SSD and has good RW speeds.

Still, SSD access speeds are no match for Memory/Cache access speeds.

luishp and smartmedia have reacted to this post.
luishpsmartmedia