Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

初始化优化建议 #2

Closed
cj0x39e opened this issue Apr 18, 2017 · 1 comment
Closed

初始化优化建议 #2

cj0x39e opened this issue Apr 18, 2017 · 1 comment

Comments

@cj0x39e
Copy link

cj0x39e commented Apr 18, 2017

因为在 echarts.js 的实现里面,使用了 setTimeout ,被 zone.js 包装了的 setTimeout 会频繁触发 docheck 的钩子,如果应用中有组件实现了该生命周期的钩子,将会不断触发,导致性能下降。

可以用 NgZone 提供的 runOutsideAngular 方法优化:

constructor(private zone: NgZone) {}
....
this.zone.runOutsideAngular(() => {
    this.chart = echarts.init(this.host.nativeElement, this.theme, this.style ? {}:this.opts);
 });
@twp0217
Copy link
Owner

twp0217 commented Apr 19, 2017

感谢建议,晚点更新上库

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants