当前位置:网站首页>【疑问】最终推荐的loose pattern 如果依赖module 没有加载完毕,行为如何,是否报错
【疑问】最终推荐的loose pattern 如果依赖module 没有加载完毕,行为如何,是否报错
2022-08-02 04:25:00 【zsy_1991】
Loose Augmentation
While our example above requires our initial module creation to be first, and the augmentation to happen second, that isn’t always necessary. One of the best things a JavaScript application can do for performance is to load scripts asynchronously. We can create flexible multi-part modules that can load themselves in any order with loose augmentation. Each file should have the following structure:
var MODULE = (function (my) {
// add capabilities...
return my;
}(MODULE || {
}));
In this pattern, the var statement is always necessary. Note that the import will create the module if it does not already exist. This means you can use a tool like LABjs and load all of your module files in parallel, without needing to block.
Refrence
边栏推荐
- 投资组合分析:portfolio_analysis.Tangenvy_portfolio(切点组合)
- 力扣练习——38 分割回文串
- Liquidated damages are too high"
- 数学建模学习(76):多目标线性规划模型(理想法、线性加权法、最大最小法),模型敏感性分析
- Use the advanced timer of GD32F207 to generate hidden bugs in PWM waves
- Arduino框架下ESP32重启原因串口信息输出示例
- Unreal回放系统剖析(上)
- 使用GD32F207的高级定时器来产生PWM波出现的隐藏BUG
- 数据可视化之百变柱状图
- Go 语言是如何实现切片扩容的?【slice】
猜你喜欢
随机推荐
PyQt5_pyqtgraph鼠标在折线图上画直线
高等数学(第七版)同济大学 总习题三(前10题) 个人解答
温暖的世界
如果有些字段不想进行序列化怎么办?
【云原生】DevOps 新纪元 | 史前的惨淡现实
Platts Analysis-MATLAB Toolbox Function
C语言:结构体总结
Go 语言是如何实现切片扩容的?【slice】
Line generation 005
自定义一个下划线分词器
Learn about the sequential storage structure of binary tree - heap
递归实现排列型枚举(DAY 93)
How to decrypt worksheet protection in Excel
2022 Huawei Software Elite Challenge (Preliminary) - Summary
我们擅长的地方很多
数据可视化之百变柱状图
7亿听众背后的在线音频掘金故事
已更新 联通 电信 tiny模式
压缩包密码如何快速删除?
投资组合分析:portfolio_analysis.Tangenvy_portfolio(切点组合)