简体   繁体   English

我在本地服务器上运行时无法显示页面

[英]can't display page when i run on local server

Every time I try to run my code on a local server, my laptop gets so slow and warm and the page won't display as shown below. 每次尝试在本地服务器上运行代码时,我的笔记本电脑都变得如此缓慢和发热,并且该页面不会显示如下。

在此处输入图片说明

The source code looks like I am in an infinite loop but can't figure out what's wrong. 源代码看起来像是处于无限循环中,但无法弄清楚出了什么问题。

deck.addEventListener('click', event => {
  const clickTarget = event.target;

  if (clickTarget.classList.contains('card') &&
    !clickTarget.classList.contains('match') && toggledCards.length < 2 &&
    !toggledCards.includes(clickTarget)) {
    toggleCard(clickTarget);
    addToggleCard(clickTarget);
    if (toggledCards.length === 2) {
      checkForMatch(clickTarget);
    }
  }
});

99% times when cpu goes crazy and that pop up shows. 当cpu疯狂并弹出时显示99%的时间。 It's because of a endless loop. 这是因为循环不断。

Probably one of the called functions, makes a click somewhere. 可能是其中一个被调用的函数,在某处单击。 To avoid it you have to debug the functions like @dustytrash advised. 为了避免这种情况,您必须调试@dustytrash建议的功能。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果我是从在线数据库服务器获取的,则无法在页面上显示json数据返回,但它可以在本地服务器数据库上使用 - Can't display json data return on page if I get it from online database server but it works on local server database 为什么我有重新加载页面以便在运行服务器时显示脚本? (Gulp / Webpack / React) - Why do I have reload page in order for script to display when I run the server? (Gulp/Webpack/React) 想在加载页面时使用节点在本地服务器上运行我的 html 页面,但 css 文件无法正常工作 - want to run my html page on local server using node when i am loading the page but the css file is not working 无法在本地服务器上运行xmlHttp.responseXML - Can't run xmlHttp.responseXML on a local server 如何从我的网页运行本地服务器脚本? - how can i run a local server script from my webpage? 我无法从本地文件运行facebook js api? - I can't run facebook js api from local file? 我可以连接到外部服务器并更改显示页面吗 - Can I connect to external server and change my display page 显示页面时无法显示生成的数据 - Can't display generated data when a page is displayed 当我需要运行服务器端代码时,如何响应单击按钮(不提交页面)? - How can I respond to the click of a button (without a submission of the page) when I need to run server-side code? 我在 Apache 服务器上运行 ReactJS 构建时的空白页面 - Blank page when I run ReactJS build on Apache server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM