当前位置:网站首页>【疑问】最终推荐的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
边栏推荐
猜你喜欢

关于地图GIS开发事项的一次实践整理(上)

Line generation 005

LeetCode 23: 合并K个升序链表

batch_size of deep learning foundation

Visual SLAM Lecture Fourteen - Lecture 13 Practice: Designing a SLAM system (the most detailed code debugging and running steps)

单调队列模板 滑动窗口

开放原子开源峰会落幕,百度超级链牵头成立XuperCore开源工作组

26. 如何判断一个对象是否存活?(或者GC对象的判定方法)?

被大厂强制毕业,两个月空窗期死背八股文,幸好上岸,不然房贷都还不上了

跑通CogView教程
随机推荐
Qt FAQ
【数字IC手撕代码】Verilog固定优先级仲裁器|题目|原理|设计|仿真
Use the advanced timer of GD32F207 to generate hidden bugs in PWM waves
batch_size of deep learning foundation
DOM系列之 click 延时解决方案
“数字化重构系统,搞定 CEO 是第一步”
论人生自动化
lvm扩容(实战无废话)
如何让固定点的监控设备在EasyCVR平台GIS电子地图上显示地理位置?
LeetCode 23: 合并K个升序链表
自定义一个下划线分词器
立方体卫星Light-1
递归实现组合型枚举(DAY 92)
YOLOV5学习笔记(四)——项目目录及代码讲解
[Errno 13] Permission denied:’/usr/local/share/jupyter’
抓住那头牛(DAY 96)
Excel如何解密工作表保护
跑通CogView教程
力扣练习——45 二叉树的锯齿形层次遍历
Minecraft 1.18.1, 1.18.2 module development 23.3D animation armor production