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

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

互动投影墙深受展览展示喜爱的原因分析

Crawler_crawl wasde monthly supply and demand balance table (example)

投资组合分析:portfolio_analysis.Tangenvy_portfolio(切点组合)

How to save a section of pages in a PDF as a new PDF file

批量--09---批量读文件入表

洛谷P2437蜜蜂路线

数据可视化之百变柱状图

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

LeetCode 23: 合并K个升序链表
随机推荐
Scala基础【常用方法补充、模式匹配】
What if some fields don't want to be serialized?
How to save a section of pages in a PDF as a new PDF file
HyperLynx中层叠设计实例
Deep Blue Academy - Handwritten VIO Homework - Chapter 2
【每日一题】1374. 生成每种字符都是奇数个的字符串
CodeTON Round 2 (Div. 1 + Div. 2, Rated, Prizes!) C题
互动投影墙深受展览展示喜爱的原因分析
使用GD32F207的高级定时器来产生PWM波出现的隐藏BUG
通关剑指 Offer——剑指 Offer II 008. 和大于等于 target 的最短子数组
力扣 剑指 Offer 56 - I. 数组中数字出现的次数
浅学一下二叉树的顺序存储结构——堆
gergovia's deal tijie
Learn about the sequential storage structure of binary tree - heap
递归实现组合型枚举(DAY 92)
Digicert EV证书签名后出现“证书对于请求用法无效”的解决方案
地牢大师(DAY 95)
Batch normalization (BN) based on deep learning
Deep blue college - handwritten VIO operations - the first chapter
ADSP21489工程中LDF文件配置详解