Upon exchanging data with the router located in the navigation bar, a continuous loop occurs as I initiate the download operation involving the electron-dl and electron-download-manager tools

When I switch to the router in the navbar, a loop occurs when I try to initiate the download process. I've been struggling with this issue for the past 2 days and can't seem to find a solution.

function downloaddosya1() {
  console.log("Files1 downloading...")
  const url = "http://ipv4.download.thinkbroadband.com/100MB.zip"
  ipcRenderer.invoke("downloadmng",url);
}
// DOSYA 1
function checkdosya() {
const yereldosya = 'C:\\test\\xampp-control.exe'
const yereldosyahash ='ed4d6fdb6248bcff64e5652cd0c9d79c483bace94c1120dc3128645f00a5e5c4'
fs.exists(yereldosya, function(exists) { 
  if (exists) { 
    console.log("Dosya Var")
getChecksum(yereldosya)
.then(checksum => { apidosya(checksum) })
.catch(err => console.log(err));
const apidosya = async(checksum) => {
  if(checksum == yereldosyahash){
      checkdosyadone()
}else{
  console.log("Files 1 False")
  downloaddosya1()
}
}
}else{
    console.log("Dosya Yok")
    downloaddosya1()
}
});
}

Answer №1

<div class="topPanel"><div id="panel"></div>
    <router-link to="Dashboard" class="topPanelItem textMenu" active-class="activeMenu">Home</router-link>
    <router-link to="Store" class="topPanelItem textMenu" active-class="activeMenu">Store</router-link>
    <div @click="checkdosya()" to="Play" id="logoBN" class="playButton">Play</div>
    <router-link to="News" class="topPanelItem textMenu" active-class="activeMenu">News</router-link>
    <div  @click="CreateAcc()" class="topPanelItem textMenu">Support</div>
    <div  @click="CreateAcc()" class="topPanelItem textMenu2">Forum</div>
    <div  @click="downloadmng()" class="topPanelItem textMenu2">Discord</div>
  </div>

i am unable to provide other code but I can share files.

ipcMain.handle("downloadmng",(event,url)=>{
  downloader.download({
    url: url,
    onProgress: (progress,item) => {
      event.sender.send("progress",progress);
    }
  },function(error,info){
    event.sender.send("downloadmngtrue");
    event.sender.send("info",info)
  })

Answer №2

it appears that there may be an issue with the routing or the main renderer

this main process

    ipcMain.handle("downloadmng",(event,url)=>{
  downloader.download({
    url: url,
    onProgress: (progress,item) => {
      event.sender.send("progress",progress);
    }

this navigation bar

    <div class="topPanel"><div id="panel"></div>
    <router-link to="Dashboard" class="topPanelItem textMenu" active-class="activeMenu">Home</router-link>
    <router-link to="Store" class="topPanelItem textMenu" active-class="activeMenu">Store</router-link>
    <div @click="checkdosya()" to="Play" id="logoBN" class="playButton">Play</div>
    <router-link to="News" class="topPanelItem textMenu" active-class="activeMenu">News</router-link>
    <div  @click="CreateAcc()" class="topPanelItem textMenu">Support</div>
    <div  @click="CreateAcc()" class="topPanelItem textMenu2">Forum</div>
    <div  @click="downloadmng()" class="topPanelItem textMenu2">Discord</div>
  </div>

this download feature

'
const url = "http://ipv4.download.thinkbroadband.com/100MB.zip"
ipcRenderer.invoke("downloadmng",url);

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having trouble with your Ajax post request?

I am currently working on creating a form that allows users to input information and submit it without the page refreshing. The processing of the form data will occur after the user clicks the submit button. To achieve this, I am utilizing jQuery and Ajax ...

Setting a cookie using express.js with a 'j' prefix

Trying to establish a cookie using res.cookie as shown below: res.cookie('userId',req.user._id); //cookie set here console.log(req.user._id); //correct value returned, eg abc However, I'm noticing j:"abc" in my cookie. What could be the re ...

Exploring techniques to maintain search functionality on altered display columns in DataTables.js

How can I ensure that the search functionality works properly on the modified render column in DataTables.js? In the code snippet provided below, my attempts to search data within the render columns are not yielding any results. $('#release-table& ...

Implementing real-time style changes with Angular 6 through Environment Variables

Attempting to dynamically change styles in Angular 6 using environment variables has been a success for me. Here is how my file structure is organized: src -app -assets -environments -scss -theme1.scss -theme2.scss -_variables.scss -styles.sc ...

Send the user to the login page once their email has been verified

On my website, I have a process where users need to verify their email by clicking on a link sent through emails. When the user clicks on this verification link, I want them to be redirected to a page thanking them for confirming their account and then a ...

Exploring the power of d3 in Vue through force-graph integration

I am currently working with force-graph in a Vue project. I have installed force-graph using npm and imported ForceGraph into a single-file Vue component. However, when attempting to use the following code for a ForceGraph Graph Graph.d3Force("link",d3.for ...

What is the most efficient way to calculate the total sum of all product amounts without using Jquery?

I am working with a dynamic table where data is inserted and the total of each product is calculated by multiplying the price by the quantity. What I need now is to get the sum of all the totals for each product. You can see how the table looks here: htt ...

Trigger the onclick method by selecting an icon within the MUI DataGrid

Currently, I am utilizing the default MUI Dialog model in the "DialogModel.js" component. Additionally, I have integrated another MUI DataGrid component as shown below: // RulesTable.js import * as React from 'react'; import { DataGrid } from &a ...

Ways to showcase the outcome of a spin after each rotation

I am currently working on a spinning code snippet that allows users to spin and potentially win different amounts. The code includes functionality to prevent more than 3 spins, set random rotation values, and animate the spinning effect. However, I now wa ...

React 18 doesn't trigger component re-rendering with redux

In my code, I have implemented a custom hook to handle global data fetching based on user authentication. Here is an example of the hook: const userState = useSelector(state => state.user.state) useEffect(() => { if(userState === "authentic ...

Converting a Curl command to a JavaScript POST request: best practices

Is it possible to convert the given curl code into a JavaScript post request that will function effectively in all browsers? curl https://connect.stripe.com/oauth/token \ -d client_secret=sk_test_f7PKXx5NRBFG5r41nTrPT7qB \ -d code="{AUTHORIZATIO ...

Tips for successfully transferring an image through an XMLHttpRequest

I found this helpful resource at: I decided to test out the second block of code. When I made changes in the handleForm function, it looked like this: function handleForm(e) { e.preventDefault(); var data = new FormData(); f ...

Ways to modify the text of an HTML element when hovering over it

One of my elements contains the text &times; within a <span>. Is there a way to change this symbol to something else, like &infin;, when hovered over? <span class="change-text">&times;</span> When the mouse hovers over it, I ...

Tips on displaying each element of an array in a unique format within a React component

I am working on creating a component that will display data in boxes. Each set of constant data should be placed within a div for organization. Currently, I have a Box component that is responsible for displaying the data. The Tutorial component receives ...

Tips for managing the second datepicker for the return journey on Abhibus using Selenium webdriver

I am currently working on a code to choose departure date and return journey date, but I am encountering an issue where the return journey date is not being selected. The driver seems to be skipping over the return date selection and proceeding directly to ...

Guide to implementing Pug syntax highlighting in Vue templates on Sublime Text 3

Is there a way to make Sublime 3 highlight the Pug syntax used within Vue templates? I define my Vue templates using Pug within <template> tags. You can check out this image for an example. Are there any plugins available for this specific task? ...

Setting up parameters and arguments in Vuex mutations: A guide

I am currently developing a todo list application using Vue.js, Vuex, and Firebase. The functionality of the app seems to be in working order with the Store file effectively managing the retrieval and display of entered todo items to and from Firestore. Ho ...

How can I combine these scripts that are not working simultaneously?

I have two scripts on my site that are based on the meta title, and I'm trying to make them work together. I thought changing the function names would be enough, but when I use both scripts, one doesn't work. Why is this happening? Also, should I ...

Storing a Vue/JS element reference in a constant using Typescript

In my template, I have one form element and one button element: <button type="submit" id="ms_sign_in_submit" ref="submitButton" class="btn btn-lg btn-primary w-100 mb-5"> </button> Wi ...

How can the label value be updated in a material ui slider component?

code snippet: https://codesandbox.io/s/runtime-worker-kxse3?file=/src/App.js Can anyone help me ensure that the labels in the bubble display the same values as the text (3, 5, 7, 10)? ...