Saturday, February 26, 2022

New Functionality: Session Storage interaction

Just added to BASIC Anywhere Machine:

  • SetSessionStorageItem(key, value)
  • GetSessionStorageItem(key)

Sample BASIC program:

SetSessionStorageItem ("salutation", "howdy, buddy")
Print GetSessionStorageItem ("salutation")
SetSessionStorageItem (1, 5)
Print GetSessionStorageItem (1)


Please take the following with a grain of salt, as this is my recently acquired understanding based on what I've read (experience-based understanding is pending!):

Difference between these and the "LocalStorage" counterparts:

  • LocalStorage is persistent (i.e. will still be available after browser/computer restart) and shared among all "same site" web pages across open same-browser instances and browser tabs
  • SessionStorage is temporary and only persistent in the current browser tab's access to a web page (close the tab or navigate to some other website, and temporary storage is gone.)

More info to follow as I slowly wrap my mind around practical uses cases for one vs the other.

Cheers !

No comments:

Post a Comment

🖥 Fan Dance

This is a port and mod of a SpecBAS program by ZXDunny. Run the program View the source code And, a "less is more?" version: Run t...