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

ECharts support asynchronous Immediately Invoked Function Expression (IIFE) #8015

Merged
merged 1 commit into from Apr 17, 2023

Conversation

Zuoqiu-Yingyi
Copy link
Contributor

@Zuoqiu-Yingyi Zuoqiu-Yingyi commented Apr 17, 2023

  • Please commit to the dev branch 请提交到 dev 开发分支
  • ECharts 解析过程使用异步调用, 避免数据规模较大时阻塞渲染进程
    The ECharts parsing process uses asynchronous calls to avoid blocking the rendering process when the data is large.
  • 支持 Echarts 使用异步自执行函数提供待渲染的内容
    ECharts suport asynchronous Immediately Invoked Function Expression (IIFE) to provide the content to be rendered.

已通过测试 | Tested passed
OS: Windows 11 22H2 22621.1555

@Vanessa219
Copy link
Member

这个好像不是一个异步函数

@Zuoqiu-Yingyi
Copy link
Contributor Author

这个好像不是一个异步函数

是说 looseJsonParse 这个函数吗, 这个函数如果返回一个 Promise 就是一个异步函数, 如果返回非 Promise 就是一个同步函数, 对同步函数使用 await 关键字会直接返回该同步函数的返回值, 因此实际上不影响调用

@Vanessa219
Copy link
Member

这个不使用也会返回,这段以前好像还是你提交的,用 await 的作用和好处是?

return Function(`"use strict";return (${text})`)();

@Zuoqiu-Yingyi
Copy link
Contributor Author

Zuoqiu-Yingyi commented Apr 17, 2023

这个不使用也会返回,这段以前好像还是你提交的,用 await 的作用和好处是?

有些数据可能需要动态请求动态解析, 如果使用同步请求的话会阻塞渲染进程, 这时候需要就需要使用异步请求了

这里有一个使用同步请求的示例 思源笔记折腾记录 echarts- 热力图 -2023 年文档统计 - 链滴

@Vanessa219 Vanessa219 merged commit b13398c into siyuan-note:dev Apr 17, 2023
2 checks passed
@Zuoqiu-Yingyi Zuoqiu-Yingyi deleted the dev-feat-sync-echarts branch April 17, 2023 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants