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

Bring in a collection of classes of various types from one TypeScript file to another

In my code file exampleA.ts, I define an object as follows: import { ExampleClass } from 'example.ts'; export const dynamicImportations = { ExampleClass }; Later, in another file named exampleB.ts, I import an array that includes class types and ...

Angular Material Drop Down menu with UI-Router Integration

When the user clicks on the person icon, it triggers a form (form.html) using the ui-router logic defined in app.js. There are two types of dropdown boxes - one using the select tag and the other using the md-select tag. Everything works fine until I click ...

I am a newcomer to Stack Overflow and I am facing difficulty in getting my form to submit successfully

Excuse any errors as I am new to this. I am facing an issue where my form is not submitting anything in the console. Could it be because my entire HTML file is within a return statement from a JavaScript function? I assumed it would work since I imported a ...

The Chrome extension is unable to add text to the existing window

Lately, I've been attempting to develop an extension that will automatically add a div to the beginning of the current page. I've been following the guide provided on this https://developer.chrome.com/extensions/activeTab page. The code from the ...

Utilizing JSON Data for Dynamically Displaying Database Objects on a Google Map

After carefully reviewing the information provided in the initial responses and working on implementation, I am updating this question. I am currently utilizing the Google Maps API to incorporate a map into my Ruby on Rails website. Within my markets mode ...

Weapons of Mass Destruction - receive markdown content

My application is utilizing a markdown editor from Google Code. $(document).ready(function () { var converter = Markdown.getSanitizingConverter(); var editor = new Markdown.Editor(converter); editor.run(); }); <div class="wmd-panel"> ...

"Learn how to pass around shared state among reducers in React using hooks, all without the need for Redux

I've built a React hooks application in TypeScript that utilizes multiple reducers and the context API. My goal is to maintain a single error state across all reducers which can be managed through the errorReducer. The issue arises when I try to upd ...

Injecting dependencies in AngularJS when utilizing the controller-as syntax: A how-to guide

As I dive into the controller-as feature outlined in the documentation, I'm refining one of my controllers to align with their recommended syntax. However, I'm facing a challenge when it comes to injecting the $http service into my search() funct ...

What are some strategies for creating a website that caters to both web crawlers and users of single page applications?

Let's get down to the specifics. I've got a frontend website at (don't worry, it's not porn). If you have javascript enabled, the URL becomes [this uses jquery/ajax load]. If you're without javascript, the URL remains as . To ...

How can I retrieve an array of collections from multiple parent documents in Firebase and pass them as props in Next.js?

I need to access all the collections within the documents stored in a collection named users. This is how I currently retrieve all the user information: export async function getServerSideProps() { const snapshot = await firebase .firestore() .collection ...

Unable to retrieve the value from an object (Javascript)

window.addEventListener('keydown', (e) => { let arrowsObj = { "ArrowUp": 1, "ArrowDown": 2, "ArrowLeft": 3, "ArrowRight": 4 } let eventKey = e.key; console.log(arrowsObj.eventKey); }); Despite p ...

How to achieve a successful response with Ajax and jQuery?

I'm currently working on practicing data retrieval through an API using jQuery. After watching a few YouTube tutorials, I still can't seem to get a successful response... it's quite frustrating. Aside from YouTube, I'm also a subscribe ...

Changing the value of a variable after iterating through an array in JavaScript

I'm just getting started with programming and teaching myself. I'm struggling to grasp how to update a variable by iterating through an array. Here's an array containing the best pies, each with its own price: [blueberry, strawberry, pumpk ...

Regular expressions can be used to extract specific attributes and inner content from a div element within a contentEditable container

Context I am currently developing a tagging system called @Name for my website. Successfully, I have managed to detect names upon keystroke and replace the content with the corresponding div class='tag' data-id='User-id'>Name</di ...

NextJS is like the master of ceremonies in the world of backend

As I was searching for the top JS backend frameworks, I came across NextJS which is considered to be one of the best. Initially, I thought NextJS was just a simplified version of CRA and still required Node.js as the backend. This brought me back to my c ...

Configuring the TradingView widget with NextJS Script

Struggling with transferring an article on my website from Jekyll to NextJS, I'm facing a roadblock in passing widget configuration to the built-in Script component. The widget doesn't display as it should. Below is the snippet of code causing th ...

Ordering styles in Material UI

I've spent countless hours customizing this element to perfection, but the more I work on it, the more of a headache it gives me. The element in question is an outlined TextField, and my focus has been on styling its label and border. Initially, I th ...

How can I extract the text enclosed in <li> tags using JavaScript?

Can someone help me with retrieving the text content of li tags? I managed to get a list of lis, but I'm having trouble assigning the text content to my country object. Snippet var lis = document.getElementById("navbar").getElementsByTagName("l ...

Changing the names of the validation messages in Laravel

Currently, I am developing the backend of my project using Laravel. One of the requirements is to validate both a password field and its confirmation field. To achieve this, I have implemented the following validation rules: $rules = [ 'password& ...

trouble encountered when attempting to integrate typeahead functionality in AngularJS using jQuery

Greetings! I am brand new to using AngularJS and currently exploring the implementation of typeahead functionality. I decided to utilize an existing library by including the following script: <script src="lib/xyz/typeahead.bundle.js"></script> ...