当前位置:网站首页>6-13 提高加载性能 - 应用缓存
6-13 提高加载性能 - 应用缓存
2022-06-22 10:43:00 【bus_lupe】
const cache = {
} // 根据子应用的name来做缓存
export const parseHtml = async (entry, name) => {
if (cache[name]) {
return cache[name]
}
const html = await fetchResource(entry)
let allScript = []
const div = document.createElement('div')
div.innerHTML = html
const [dom, scriptUrl, script] = await getResources(div, entry)
const fetchedScripts = await Promise.all(scriptUrl.map(async item => fetchResource(item)))
allScript = script.concat(fetchedScripts)
cache[name] = [dom, allScript]
return [dom, allScript]
}
边栏推荐
- [graduation season · advanced technology Er] youth never ends
- Heidisql inserts records. There are always errors. How do you change them?
- JG_fx_20220620
- Good news - agile technology was selected into the 2022 China top 100 Digital Security Report
- scrapy.Request() 的 meta参数 数据的传递
- On the routing tree of gin
- Nodejs basic quick review
- 喜讯丨敏捷科技入选《2022年中国数字安全百强报告》
- Target detection / segmentation training using pytorch mask RCNN
- 【jmeter】shell脚本自动执行jmeter
猜你喜欢

A special file upload

Basic principles of the Internet

Byte 3: do you know what Eureka is?

Batch create / delete files, folders, modify file name suffixes
推荐一款M1芯片电脑快速搭建集群的虚拟机软件

【直播回顾】战码先锋第六期:共建测试子系统,赋能开发者提高代码质量

Laravel 中类似 WordPress 的钩子和过滤器

2022-06-09 工作记录--yarn/npm-Error-EPERM: operation not permitted, uv_cwd

AttributeError: module ‘skimage. draw‘ has no attribute ‘circle‘

今天,SysAK 是如何实现业务抖动监控及诊断?&手把手带你体验Anolis OS|第25-26期
随机推荐
Use of libevent
麒麟软件携手格尔软件聚焦网络数据安全发展
无线802.1x认证简介及配置方法
Byte 2: why is the key of the redis master node expired, but the expired data is still read from the secondary node? How to solve it?
免费易用 ,腾讯Arm云实例评测 - AI推理加速
[graduation season · advanced technology Er] youth never ends
【jenkins】shell脚本调jenkins api接口
laravel 开发 文章URL 生成器
Investment transaction management
TCP建立连接过程(深入源码理解3次握手)
Zero‐Copy API
TCP异常连接
论文精读:Generative Adversarial Imitation Learning(生成对抗模仿学习)
WordPress like hooks and filters in laravel
【jmeter】shell脚本自动执行jmeter
Pule frog VR typhoon escape experience VR disaster self rescue simulation system VR popular science knowledge equipment
After using Matplotlib for so long, I didn't know that the data could move
一条TCP连接时占用内存空间多少?
Discussion on the open source GIS solution of our company
Duxiaoyong, head of virtual teaching and Research Office of database course: Based on the major needs of domestic databases, explore a new mode of course system construction