Results 1 to 4 of 4

Thread: Localstorage and scope

  1. #1
    Senior Member
    Join Date
    Apr 2012
    Location
    United Kingdom
    Posts
    657

    Localstorage and scope

    Hi Barry,

    In my recent ticket you said:

    Localstorage persists across apps HOWEVER to share objects you must json_encode() and json_decode() them as they go out of scope and are released when you close an app and open another.

    That is true about sessionStorage() also.

    You can store objects as i suggested but only for the app. after that you need to reinitialize.."

    If I have Lianja.localstorage.aim.opref and need to call a prg from my app, say for some data validation code to say set user interface settings, rather than actual data validation before a save, is the Lianja.localstorage.aim.opref in scope in the prg?

    For a desktop app if I used _screen.aim.oPref is that in scope everywhere, if I create it in my setup.prg ?

    When you say "you must json_encode() and json_decode()" is that when creating them or do you mean to pass them to the other app I need to do that?

    David


    David

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,889
    Blog Entries
    18
    Hi David,

    Lets not get confused.

    localstorage is accessible from within the app builder (or runtime). Is is "local" to that executable. All procs and prg files you call have access to localstorage.

    sessionstorage is accessible from all runtime executables. It is used to share data between executables. When you access members in sessionstorage lianja uses semaphores to lock and unlock the data. You dont need to do that.

    You can't share in memory objects between two executables so you must store then using json_encode() and json_decode() as they are strings.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  3. #3
    Senior Member
    Join Date
    Apr 2012
    Location
    United Kingdom
    Posts
    657
    Thanks Barry,

    I'll take another look at the help file on sessionstorage

    David

  4. #4
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,889
    Blog Entries
    18
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us