No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Persistence for Electron/Cordova?

    Framework
    3
    8
    475
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      amoss last edited by

      Hi

      There’s one thing that I’m still confused about: I develop using quasar.

      I run quasar build and create a web application that runs on my server.
      I run quasar build -m electron and create a Windows executable that runs on my Windows OS.
      I run quasar build -m cordova -T android and create an APK file that runs on my Android device.

      For all 3 modes, I want to store something locally (a small settings file with a very simplistic data). I want it to be stored cross session so the next time the user opens up the app/lication/APK, that data will be available for him.

      Is there a one-size-fits-all mechanism for this?
      Thanks

      dobbel 1 Reply Last reply Reply Quote 0
      • dobbel
        dobbel @amoss last edited by dobbel

        @amoss

        I run quasar build and create a web application that runs on my server.

        No Quasar, and in general all webapp’s made in JS(SPA’s) run on the client’s web browser. The role of the server (where Quasar resides) is serving the files to the client’s web browser ( SSR not taken into account).

        because it runs in a web browser you can use localstorage to store cross session information.

        I run quasar build -m electron and create a Windows executable that runs on my Windows OS

        Yes, but the important thing to remember is that it also run’s on web tech:
        https://en.wikipedia.org/wiki/Electron_(software_framework)

        because of this you use localstorage to store cross session information.

        I run quasar build -m cordova -T android and create an APK file that runs on my Android device.

        Yes, but the code in the apk will create a webview to run Quasar JS code on your phone just like chrome does( with a few differences, like for example cors restrictions).

        So, because it run’s in a webview you can use localstorage to store cross session information.

        For more info about localstorage: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

        Here’s th doc about a Quasar localstorage plugin( has some extra features that the standard localstorage does not have):

        https://quasar.dev/quasar-plugins/web-storage#LocalStorage-API

        1 Reply Last reply Reply Quote 0
        • A
          amoss last edited by

          I stand corrected, the js code is obviously running on the client’s browser.

          I understand what you wrote about localstorage when working with the browser.
          cordova/electron are actually a wrapper of a browser but does this “internal” browser remembers itself when I open the app again?

          dobbel 1 Reply Last reply Reply Quote 0
          • dobbel
            dobbel @amoss last edited by

            @amoss

            does this “internal” browser remembers itself when I open the app again?

            Yes it will, unless of course the user has cleared it manually. But that can happen on a normal browser too.

            1 Reply Last reply Reply Quote 0
            • A
              amoss last edited by

              Thanks a lot, I will give it a try.

              1 Reply Last reply Reply Quote 0
              • A
                amoss last edited by

                Well, it works perfectly, I always thought that in electron/cordova mode, the browser starts from scratch every time.
                Thanks a lot!!

                dobbel 1 Reply Last reply Reply Quote 0
                • dobbel
                  dobbel @amoss last edited by

                  @amoss

                  You’re welcome. There’s also a sessionStorage that will be cleared on start.

                  1 Reply Last reply Reply Quote 0
                  • G
                    gaguerrero last edited by

                    I think you could use localstorage

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post