【发布时间】:2018-02-08 17:13:24
【问题描述】:
我正在构建一个 SPA,在 Chrome 浏览器中一切正常。我尝试在 Electron 中运行相同的代码,但出现以下错误(单击按钮时):
[Violation] 'click' handler took 574ms
此外,在此错误之后,webview 和访客页面(通过ipcRenderer.sendToHost)之间的所有 IPC 调用都被阻止,即未到达 webview。
谷歌搜索告诉我阻塞 UI 的限制是 50 毫秒。有没有办法提高这个限制?
编辑:这是处理点击的代码。这是一个带有一个标签的标签栏。代码是 reactjs。
import { Link } from 'react-router';
import { Tab as MUITab } from 'material-ui/Tabs';
class TabBar extends Component {
render() {
const view = {
to: '/accounts',
id: 'accounts',
icon: 'home',
label: 'ACCOUNTS'
};
return (
<Link to={ view.to }> // <--- <a> tag in DOM, receives the click
<Tab view={ view } />
</Link>
);
}
class Tab extends Component {
static propTypes = {
view: PropTypes.object.isRequired
};
render () {
const { view } = this.props;
return (
<MUITab
icon={ view.icon }
label={
this.renderLabel(view.id)
}
/>
);
}
renderLabel (id, bubble) {
return (
<div className={ styles.label }>
<FormattedMessage
id={ `settings.views.${id}.label` }
/>
{ bubble }
</div>
);
}
}
【问题讨论】: