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

    Electron in vuex store

    Help
    2
    5
    273
    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.
    • X
      xdesai last edited by

      I’d like to import ipcRenderer from electron into my vuex store to call some actions before quitting the application. It works fine if I’m working in an electron environment, but if working spa it throws out a fs.existsSync error.

      I found some guidance on stackoverflow about using a preload script, but looking at the official docs that talks about it being used if I have node integration off which I don’t as I need it for some other stuff.

      I just wanted to check if using a pre-load script was the right thing to be doing to add electron capability to the store?

      beets 1 Reply Last reply Reply Quote 0
      • beets
        beets @xdesai last edited by

        @xdesai ipcRenderer definitely won’t work in SPA mode. What are you trying to accomplish here? Are you wanting to build both to Electron and SPA? As in publish a desktop app and an online app?

        1 Reply Last reply Reply Quote 0
        • X
          xdesai last edited by

          Yes, I’ve got a bit of an odd use case where some users might need offline capability for a while hence the electron (and I want to use Node integration for other stuff so not pwa) whereas others will be using it online only hence spa. I could probably write a separate connection that electron could call to through node bindings if I need to. As an aside, I’ve been reading up more on PWAs and service workers - can I use a service worker in electron mode? How would I go about setting that up?

          beets 1 Reply Last reply Reply Quote 0
          • beets
            beets @xdesai last edited by

            @xdesai So, with SPA mode, you have no access to node bindings. That means that whatever functionality you’re using from electron, you won’t have access to with SPA, and need to replace with either regular old Javascript, or an API. If those functionalities include things like accessing the user’s filesystem, you need to rethink the SPA part of it. Can you give a high level overview of what your app does?

            Also, there’s not really a need for using a service worker with electron. Again, if you’re able to explain what you want to do, we can give guidance.

            X 1 Reply Last reply Reply Quote 0
            • X
              xdesai @beets last edited by

              @beets I’d like to still be able to show some images (potentially videos) to the offline users (content in firebase storage), as well as upload any content when back online. Some of the content they might not have navigated to specifically before, so before quitting the app I wanted to do a sync (hence doing a call to the store from electron main) to download files to filesystem (functionality not required for SPA users). I have figured out how to spin up a local express app to serve the content as static. I’ve never done anything with caching before, but was reading up a bit about service workers ability to do so for offline content, hence the question.

              I’m also using the Node integration for an admin module that will only ship on the electron version.

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