我正在尝试在我的项目中实现Facebook的注销功能.登录工作正常.但我正面临着使用注销代码在JavaScript控制台中获取以下消息.
[违规]长时间运行的JavaScript任务需要318ms session.php:51 1 sdk.js:135
[Violation]处理程序运行时间为83毫秒(允许50毫秒)
我试图寻找其他类似的线程,这些解决方案对我来说没有用.我尝试删除部分代码,看看哪个部分有问题.很明显,由于Facebook的JS SDK导致错误,如消息中所示.我还停用了所有Chrome扩展程序.
代码在Firefox中运行良好,但在Chrome和Opera中都不行.我有什么方法可以延长这个超时时间吗?或者在chrome中解决此问题的任何其他方法.这是我的注销代码.
<?php
session_start();
//echo $_SESSION["current_user"];
//echo $_COOKIE["current_user"];
session_destroy();
unset($_COOKIE["current_user"]);
setcookie("current_user","",time() -3600, "/","", 0);
//header("location: login.php");
?>
<!doctype html>
<html>
<head>
</head>
<body>
<script>
// Default settings
window.fbAsyncInit = function() {
FB.init({
appId : '<app-id>',
cookie : true,
xfbml : true,
version : 'v2.8'
});
FB.AppEvents.logPageView();
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs); …Run Code Online (Sandbox Code Playgroud) 我有一个包含一些元素的网页,并且也Ant.design slider存在。滑块值由 React 状态控制。当滑块工具提示打开时,滑块速度非常慢,在控制台中我看到一条消息[Violation] Forced reflow while executing Javascript took ...。
当滑块工具提示关闭时,滑块速度变为正常。如果我只将鼠标指向滑块手柄(不移动手柄),则消息也会出现在控制台中。
如何使用工具提示修复不良行为?提前致谢!
该数组包含随机值,如let checkTypes = ['a','b','c'];。(数组的长度也是随机的。)
并且,数组尝试this.switch()按数组的数量调用函数。
所以,我的代码是...
for (let i = 0; i <= checkTypes.length-1; i++) {
window.setTimeout(() => {
this.switch(checkTypes[i]);
if (i != 0 && i != checkTypes.length -1) window.setTimeout(() => this.switch(checkTypes[i+1]))
});
}
Run Code Online (Sandbox Code Playgroud)
[Violation] 'setTimeout' handler took <N>ms开发者的工具控制台中仍然存在以下错误(),感觉我的代码似乎无法正常工作。
我可以更改代码以免出现此错误吗?
我正在写与生成的应用程序create-react-app有redux,react-redux和react-router.每当我点击Link这样的话:
import React from 'react'
import { Link } from 'react-router'
import ThingCard from '../../components/ThingCard'
const ThingsList = ({things}) => {
return (
<ul>
{things.map(thing =>
<Link to={"/things/"+thing.id} key={thing.id}><ThingCard thing={thing}/></Link>
)}
</ul>
)
}
export default ThingsList
Run Code Online (Sandbox Code Playgroud)
我在控制台中看到以下警告.我不知道他们来自哪里或者他们的意思.谷歌搜索没有产生任何有用的结果.是否可以安全地忽略这些警告,如果不能,我怎样才能更多地了解它们?我相信这个问题阻止了父页面呈现它的孩子.
我已禁用所有网络请求.
编辑:此错误仅显示在Chrome Canary而不是Google Chrome中.但是,Google Chrome无法正确呈现孩子(可能是由于此问题)
更新到最新的Google Chrome版本后,当我们在我们的网站上打开彩盒时,我们会收到错误:
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
[Violation] 'readystatechange' handler took 760ms
[Violation] Forced reflow while executing JavaScript took 51ms
[Violation] Forced reflow while executing JavaScript took 43ms
[Violation] Forced reflow while executing JavaScript took 38ms
Run Code Online (Sandbox Code Playgroud)
这种情况有时只会发生,当我们得到这些错误时,colorbox无法正常工作,Google Chrome上可能存在错误吗?
编辑:Magento合并javascript导致错误,它不能正常工作,如果我不合并他们我没有得到这些错误,它正确加载
VM23586:4 Uncaught TypeError: Cannot set property 'value' of null at choose (eval at <anonymous> (0a9e2e3….js:11743), <anonymous>:4:73) at HTMLImageElement.onclick (letto-moderno-imbottito-prisma.html:1)
Uncaught TypeError: Cannot read …Run Code Online (Sandbox Code Playgroud) 我正在使用 React 和 Styled Components 开发一个网站。但是,网站在移动设备上运行速度非常慢,并且 Google Chrome 控制台中会出现警告:
[违规] 长时间运行的 JavaScript 任务耗时 305 毫秒
所以我找到了这个问题的现有主题,并使用 React Developer Tools 寻找降低我的应用程序速度的原因。我创建了包含许多渲染项目的新空页面:
import * as React from 'react'
import { render } from 'react-dom'
const items = new Array(5000).fill({ title: 'Title', description: 'This is description.' })
render(
<>
{items.map((item, i) => (
<div>
<h1>{item.title}</h1>
<p>{item.description}</p>
</div>
))}
</>,
document.getElementById('app')
)
Run Code Online (Sandbox Code Playgroud)
React Dev Tools 分析器显示:
不过,如果我更换作出反应的div,h1并p与样式化成分Styled.div,Styled.h1和Styled.p(没有任何样式):
import * as …Run Code Online (Sandbox Code Playgroud) 我正在为C#.NET中的另一个程序编写一个插件,并且遇到性能问题,其中命令需要的时间比我想的要长很多.插件对主机程序中的事件作出反应,并且还取决于主机程序SDK的实用程序方法.我的插件有很多递归函数,因为我正在对树结构进行大量的读写操作.另外,我的插件和主机应用程序之间有很多事件订阅,以及插件中类之间的事件订阅.
我怎样才能弄清楚完成任务需要花费多长时间?我不能使用常规断点样式调试,因为它不是它不起作用它只是它太慢了.我已经设置了一个静态的"LogWriter"类,我可以从我的所有类中引用它,这样我就可以从我的代码中将带时间戳的行写入日志文件.还有另外一种方法吗?visual studio是否保留了我可以使用的某种带时间戳的日志?应用程序关闭后,有什么方法可以查看调用堆栈吗?
javascript ×5
reactjs ×3
performance ×2
.net ×1
antd ×1
c# ×1
colorbox ×1
debugging ×1
magento-1.9 ×1
react-router ×1
redux ×1