RequireJs学习笔记之data-main Entry Point
You will typically use a data-main script to set configuration options and then load the first application module. Note: the script tag require.js generates for your data-main module includes the async attribute. This means that you cannot assume that the load and execution of your data-main script will finish prior to other scripts referenced later in the same page.
翻译:通常会使用data-main设置的脚本里写一些配置选项,然后读取你配置里的第一个程序模块,注意require.js生成的data-main模块里的配置包含异步属性,注意你无法确定在同一个页面里面,你的data-main设置的脚本会在你其他脚本之前运行完,其他就是只的在文件位置上data-main后面的脚本
script data-main="scripts/main" src="scripts/require.js"></script>
<script src="scripts/other.js"></script>---》这个就是其他所指的文件
For example, this arrangement will fail randomly when the require.config path for the 'foo' module has not been set prior to it being require()'d later:
例如这个写法就会很容易造成问题,require.config配置的这个path属性没有在require()执行前设置,而是是在他执行后设置
<script data-main="scripts/main" src="scripts/require.js"></script>--》标签1
<script src="scripts/other.js"></script>--》标签2 // contents of main.js:
require.config({
paths: {
foo: 'libs/foo-1.1.3'
}
}); // contents of other.js: // This code might be called before the require.config() in main.js-》
// has executed. When that happens, require.js will attempt to-》
// load 'scripts/foo.js' instead of 'scripts/libs/foo-1.1.3.js'
//翻译:下面的代码或许在require.config()执行之前就被调用了,
//会造成require.js会加载script目录下的foo.js。而不是scripts/libs下的foo-1.1.3,
//在不设置baseUrl情况下requirejs会默认加载引用了requirejs文件所在的目录里的模块-》src="scripts/require.js"的
//总结就是说 不要以为标签2在标签1下面。标签1里的东西就会执行完
require( ['foo'], function( foo ) { });
RequireJs学习笔记之data-main Entry Point的更多相关文章
- C# 动态生成word文档 [C#学习笔记3]关于Main(string[ ] args)中args命令行参数 实现DataTables搜索框查询结果高亮显示 二维码神器QRCoder Asp.net MVC 中 CodeFirst 开发模式实例
C# 动态生成word文档 本文以一个简单的小例子,简述利用C#语言开发word表格相关的知识,仅供学习分享使用,如有不足之处,还请指正. 在工程中引用word的动态库 在项目中,点击项目名称右键-- ...
- Hadoop源码学习笔记(2) ——进入main函数打印包信息
Hadoop源码学习笔记(2) ——进入main函数打印包信息 找到了main函数,也建立了快速启动的方法,然后我们就进去看一看. 进入NameNode和DataNode的主函数后,发现形式差不多: ...
- [C#学习笔记3]关于Main(string[ ] args)中args命令行参数
Main(string[] args)方法是C#程序的入口,程序从这里开始执行,在这里结束.C#代码逻辑要包含在一个类型(Type)中,游离的.全局的变量或函数是不存在的,这里的类型包括类(class ...
- 学习笔记之Data analysis
Data analysis - Wikipedia https://en.wikipedia.org/wiki/Data_analysis Data analysis is a process of ...
- 学习笔记之Data Visualization
Data visualization - Wikipedia https://en.wikipedia.org/wiki/Data_visualization Data visualization o ...
- 学习笔记之Data Science
Data science - Wikipedia https://en.wikipedia.org/wiki/Data_science Data science, also known as data ...
- RequireJS学习笔记
前言 进入移动前端是很不错的选择,这块也是我希望的道路,但是不熟悉啊... 现在项目用的是require+backbone,整个框架被封装了一次,今天看了代码搞不清楚,觉得应该先从源头抓起,所以再看看 ...
- RequireJS学习笔记(转)
前言 进入移动前端是很不错的选择,这块也是我希望的道路,但是不熟悉啊... 现在项目用的是require+backbone,整个框架被封装了一次,今天看了代码搞不清楚,觉得应该先从源头抓起,所以再看看 ...
- EnterpriseLibrary 6.0(微软企业库6.0学习笔记) 之Data Access Block 配置和获取链接字符串
EnterpriseLibrary 的特点是快速开发,融合了微软工程师多年的经验,现在在微软内部有专门的一个小组在完善EnterpriseLibray,最近的更新时间是April 2013. 相关链接 ...
随机推荐
- codeforces 914E Palindromes in a Tree(点分治)
You are given a tree (a connected acyclic undirected graph) of n vertices. Vertices are numbered fro ...
- 6、Semantic-UI之动画按钮样式
6.1 动画按钮样式 在Semantic-UI中提供了三种动画样按钮式表,分别为: 左右移动 上下移动 淡入淡出 在实际开发中,很少使用这种动画按钮,根据实际情况使用,强制使用到页面中反而不太适合 ...
- word2010多级列表编号为什么会变成黑块
把光标放置在黑块的后面 在键盘上按左方向键,则黑块变灰色(为选中状态) 然后ctrl+shift+s, 出现窗口“apply styles" 点击"reapply", 搞 ...
- Service Worker 缓存文件处理
交代背景 前段时间升级了一波Google Chrome,发现我的JulyNovel站点Ctrl+F5也刷新不了,后来发现是新的Chrome已经支持Service Worker,而我的JulyNovel ...
- NPOI CellStyle 设置
public class ExcelNPOIUnit { public static void SetCell(IWorkbook workbook, ISheet sheet, IRow row, ...
- Linux Shell 编程学习笔记
1:Shell Script中if语句的条件部分要以分号来分隔 2:要注意条件测试部分中的空格.在方括号的两侧都有空格 3:echo "Hi, ${a}s" 单引号中的变量不会进行 ...
- 二十一、Node.js-EJS 模块引擎
初识 EJS 模块引擎 我们学的 EJS 是后台模板,可以把我们数据库和文件读取的数据显示到 Html 页面上面.它是一个第三方模块,需要通过 npm 安装https://www.npmjs.com/ ...
- OCP 052新加的考试题收集整理-第20道
20. Which is true about the SYSTEM and SYSAUX tablespaces? A) The SYSAUX tablespace can be made read ...
- jQuery如何追加内容?匿名函数
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- iOS 开发中类似上下滚动弹幕实现原理
#mark ---滚动弹幕 列表中留有7条记录 大于7条时删除并指引表视图向上滑动 - (void)addRowActionWithContent:(NSString *)str { if (sel ...